You need 2 hex chars to encode 256 chars. You also want the char number given by ord so this should work:
$hex = sprintf "%02x", ord($char); # but why not just do it all in one line printf "%s %02x\n", $char, ord($char);
In reply to Re: dump text file in ASCII and hex
by tachyon-II
in thread dump text file in ASCII and hex
by kevind0718
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |