in reply to Re^2: Something strange in the world or Regexes
in thread Something strange in the world or Regexes

Something I find quite helpful with one liners is B::Deparse:

>perl -MO=Deparse -lne "printf qq([%s] => %02x\n), $_, ord $_ for spli +t //" BEGIN { $/ = "\n"; $\ = "\n"; } LINE: while (defined($_ = <ARGV>)) { chomp $_; printf "[%s] => %02x\n", $_, ord $_ foreach (split(//, $_, 0)); }

So that program goes through the input, splits it between each byte, and then feeds each byte as a character and as the number to the printf function.