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

Re: Why are 5.10's named captures read only? (tuit)

by tye (Sage)
on Oct 19, 2008 at 17:22 UTC ( [id://718073]=note: print w/replies, xml ) Need Help??


in reply to Why are 5.10's named captures read only?

I actually have a module partially written that allows one to modify numbered captures.

One problem with changing Perl itself to allow either named or numbered captures to not be read-only, is that Perl is prone to make such captures actually point to a copy of the original string.

FYI, allowing modification of such interleaved substrings is an interesting and rather complex problem (especially the edge cases). But I'll write that stuff up later.

Update: Upon reading more of the thread, I see that what was wanted was to be able to modify a capture variable as a glorified temporary variable. To be clear, what my module does is allow one to modify the numbered capture such that it modifies the string variable that the regex was matched against (while ensuring all of the other numbered captures are properly made aware of the update and, if sanely possible, remain modifiable).

- tye        

  • Comment on Re: Why are 5.10's named captures read only? (tuit)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2026-02-07 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    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.