c:\@Work\Perl>perl -wMstrict -le "print 'A: found 0x13!' if unpack('H*', 'a1') =~ /13/; print 'B: found 0x13!' if unpack('h*', qq{\x{1f}s}) =~ /13/; " A: found 0x13! B: found 0x13! #### c:\@Work\Perl>perl -wMstrict -le "use Data::Dump qw(pp); ;; for my $s ('a1', qq{\x{1f}s}) { print q{'H*' found 0x13! in }, pp($s) if unpack('H*', $s) =~ /13/; print q{'h*' found 0x13! in }, pp($s) if unpack('h*', $s) =~ /13/; } " 'H*' found 0x13! in "a1" 'h*' found 0x13! in "a1" 'h*' found 0x13! in "\37s"