in reply to Subtle(?) issue(?) with lvalues and serialization
Rather than passing an array of lvalue refs, I'd pass a string of numeric pairs that characterise those substrings; and then create the substrings (or references to them), on the other side.
Ie. Pass $substrs = '10,4 15,3 20,32 ...'; and on the other side unpack them and create/process your substrings:
doWhatever( substr( $bigString, $_->[0], $_->[1] ) ) for map[ split ', +', $_ ], split ' ', $substrs;
It may seem crude, but a packed string takes far less space than an array containing the same numbers and unless your big string is greater than 64k (ie offsets greater than 16-bits) then packing to variable length ascii saves space over packing to fixed length binary with pack.
|
|---|