Yeah, if only things were so simple.
"\0001" is one character according to
your subroutine. However, Perl thinks it's two. As
tye pointed out, leading
0s aren't
required (but allowed). But for octets above
077
a leading
0 doesn't seem to be allowed. And
for octets above
377, you
will
move into Unicode territory, whether you want it or not.
"\400" causes Perl to think things are really
messed up.
-- Abigail