in reply to Converting decimal value to hex

I recommend the previously stated Data::Dumper solution, since it handles not only strings of bytes, but UNICODE strings too.
>perl -e"use Data::Dumper; $Data::Dumper::Useqq = 1; print Dumper qq{\ +x{400}};" $VAR1 = "\x{400}";

If you were dealing with bytes, you could use unpack 'H*'

>perl -le"$h = uc unpack 'H*', qq{123\t\n}; $h = ~ s/(..)/$1 /g; print + $h" 31 32 33 09 0A