# The raw data as you might read it fro the file $raw = '2010/02/03 10:52:03.123456'; print length $raw;; 26 ## First unpack in your main loop $level1hex = unpack 'H*', $raw; print $level1hex;; 323031302f30322f30332031303a35323a30332e313233343536 ## Now re-unpack it two different ways in you print_trailer() sub $level2text = unpack 'A*', $level1hex; print $level2text;; 323031302f30322f30332031303a35323a30332e313233343536 $level2hex = unpack 'H*', $level1hex; print $level2hex;; 33323330333133303266333033323266333033333230333133303361333533323361333033333265333133323333333433353336