while () { for my $ch (unpack('(a)*', $_)) { printf "Character:\t%s\t%2.2x\n", $ch, ord($ch)); } }