$output =~ s/(.)/sprintf '%02x', ord $1/seg; # ^ #### $output = unpack 'H*', $output;