my $d = $data; $d =~ s/(.)/sprintf("%x ", ord($1))/ge; print "data in hex: '$d'\n"