Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Subtle(?) issue(?) with lvalues and serialization

by BrowserUk (Patriarch)
on May 24, 2018 at 19:54 UTC ( [id://1215170]=note: print w/replies, xml ) Need Help??


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.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215170]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found