Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 ( #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.

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

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? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2021-11-27 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?