4 ms·
$ perl -E'$s = "bar"; substr($s, 1, 1) = pack("A*", 60); say $s' b60r
by mfontani 4y ago
$ perl -E'$s = "bar"; substr($s, 1, 1) = pack("A*", 60); say $s'
b60r
- richard_todd 4y agoYou have just demonstrated copying the result of the call to pack() into a string. That's what I already do, but what I want is a version that just writes over bytes in $s without creating the "60" string.