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

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}'.