binmode STDOUT; while () { chomp; print pack "H*", $_; } # Create new hex data with # perl -wle "binmode STDIN; $/ = \32; while (<>) {print unpack 'H*', $_}"