The false positive does not show on my pc unless I use unpack('h*' $_); so I am sure it is a platform/architecture scenario between our PC's.
Not a platform mismatch, I would say, but probably because you're still reading a single character at a time from the file. If more than one character is read, the /13/ ambiguity | false positive can appear with either 'H*' or 'h*' unpack templates:
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!
(BTW: The * in both 'H*' and 'h*' implies reading and operating on a string of more than one character.)
I am not up to par on Unicode because ...
... and because you value your sanity.
Update: Another, perhaps more general, code example:
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"
Give a man a fish: <%-{-{-{-<
|