my @hex = unpack ("h*", $ascii_string); foreach my $hex (@hex) { printf ("%c", hex ($hex)); }