Ah, thanks. If I understand correctly, it was 5.42 which fixed the long-standing issue with "pack 'P',".
(I think the PV method constructs new string rather than returns numeric value. I'll use "pack 'P'," for the next example, for brevity of output over Devel::Peek::Dump; there's no 5.42 below)
Wild goose chase, then, being sidetracked with imagined issue with 5.42, but initially I investigated s///, not m//. I now suspect similar reasons, related to COW, can you explain please? The 5.18 re-uses string buffer when new length is either the same or less than original. The 5.20 and then 5.26 loose both abilities.
print "$^V\n";
my $x = '0123456789';
{
my $s = "$x$x";
$s =~ s/(.)$/a/;
printf "%x\n", unpack "Q", pack "P", $s;
$s =~ s/(.)$/b/;
printf "%x\n", unpack "Q", pack "P", $s;
}
{
my $s = "$x$x";
$s =~ s/.$//;
printf "%x\n", unpack "Q", pack "P", $s;
$s =~ s/.$//;
printf "%x\n", unpack "Q", pack "P", $s;
}
__END__
v5.18.4
29cdda8
29cdda8
29ce1e8
29ce1e8
v5.20.3
2b774f8
2b774f8
2b76b78
2b76f38
v5.26.3
2c9e118
2c9d7b8
2c9da88
2b4ae88