in reply to Re: I want to know exactly what comes through a socket
in thread I want to know exactly what comes through a socket

Can I see their hex values? Or something like that ;]
I see you use sprintf and ord, but that form of using is too complicated for my poor human mind ;) Could you enlighten me a bit, please?
  • Comment on Re^2: I want to know exactly what comes through a socket

Replies are listed 'Best First'.
Re^3: I want to know exactly what comes through a socket
by ikegami (Patriarch) on Nov 23, 2005 at 21:57 UTC

    The top snippet does display their hex values (embeded in a Perl-style hex character escape).

    ord($1) returns the character number of the character in $1. For a tab, it would return the number '9'.

    sprintf("%02X", ord($1)) returns the hex character number of the character in $1. For a tab, it would return the string '09'.

    sprintf("\\x{%02X}", ord($1)) returns the hex character escape for the character in $1. For a tab, it would return the string '\x{09}'.