Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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.

  • 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?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2025-11-15 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.