{ my $input = do { open my $in, '<', $ARGV[1]; local $/; <$in> }; open my $out, '>', 'hex2.txt'; print $out unpack 'H*', $input; }