Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Concatenation with empty string -- good enough to force physical copy?

by dave_the_m (Monsignor)
on Dec 02, 2020 at 11:11 UTC ( [id://11124513]=note: print w/replies, xml ) Need Help??


in reply to Concatenation with empty string -- good enough to force physical copy?

Basically you're trying to defeat perl's copy-on-write optimisation. Concatting an empty string will currently do this, but there are no future guarantees. If you want your code to be robust you really need to handle this at the C level.

Dave.

Replies are listed 'Best First'.
Re^2: Concatenation with empty string -- good enough to force physical copy?
by vr (Curate) on Dec 03, 2020 at 06:59 UTC

    Exactly, word "CoW" was on my mind but somehow omitted when re-phrasing the question. Thank you for sharing your insight. As there's no "idiom" apparently (but wouldn't it be nice... concatenation with compile time constant treated as such), the trick with side-effect should better be avoided.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found