...It didn't do that in perl 5.8
Another difference to be aware of is this:
my $s = "\x{1234}\x{5678}"; # string with utf8 flag on print unpack("H*", $s), "\n";
With 5.8 this prints a hexdump of the internal (UTF-8) representation of the string — e.g. useful when debugging encoding issues
e188b4e599b8
while with 5.10, you'd get
3478
i.e. the low-byte values of the codepoints, with the high-byte part being truncated. With warnings enabled, you also get "Character in 'H' format wrapped in unpack at...".
With use bytes, or when explicitly turning off the utf8 flag (update: as shown below), you get the old behaviour. And specifically for debugging encoding issues, Devel::Peek is the recommended alternative since 5.10, because of this difference.
In reply to Re^2: Understanding pack and unpack changes for binary data between 5.8 and 5.10
by almut
in thread Understanding pack and unpack changes for binary data between 5.8 and 5.10
by dkg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |