# Let's pretend you have the troublesome string returned by your # DB, and that string is stored in a variable called "$db_string". # (if it's actually stored in a variable called "$x", you # could adapt it to this snippet by adding the line: # my $db_string = $x; my @db_chars = (); for my $db_char ( split //, $db_string ) { push @db_chars, sprintf( "%02x", ord( $db_char )); } for my $db_char ( @db_chars ) { printf "== %s == %s ==\n", $db_char, chr(hex($db_char)); } #### for my $db_char ( @db_chars[0..14] ) { ...