Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How do you say %+ in English?

by jaldhar (Vicar)
on Feb 10, 2009 at 16:58 UTC ( [id://742819]=perlquestion: print w/replies, xml ) Need Help??

jaldhar has asked for the wisdom of the Perl Monks concerning the following question:

I am using perl 5.10s' new named capture buffer feature to make my code more readable. It works but following the PBP guidelines, I want to use English instead of all the magic punctuation. But as far as I can tell, there is no alias for %+, the hash containing the named buffers. Am I missing something?

--
જલધર

Replies are listed 'Best First'.
Re: How do you say %+ in English?
by ikegami (Patriarch) on Feb 10, 2009 at 17:07 UTC
    %LAST_PARENT_MATCH works due to an implementation side-effect (which is why the name doesn't quite fit).
    >perl -MEnglish -le"'foo' =~ /(?<n>.*)/; print $LAST_PAREN_MATCH{n}" foo

    Update: Reworded for clarity

Re: How do you say %+ in English?
by moritz (Cardinal) on Feb 10, 2009 at 17:01 UTC
    You're not missing anything, there's no English name for that.

    We had that discussion in the CB the other day, and somebody (of course I forgot who) wanted to prepare a patch for that, but I don't know if it made its way to p5p yet.

    Update: please ignore, ikegami proved me wrong. It's just missing in the documentation

    Second update: patched documentation, Rafael applied it - so it should be documented in future versions of perl.

      Thank you and ikegami for the replies. It's not clear, did Rafael document LAST_PAREN_MATCH or will there be a more appropriate name? As the whole point of this exercise is to help in maintenance, I would rather stick with %+ then use something which will change in my next update of Perl.

      --
      જલધર

        They kept the name

        An alternative was suggested almost a year ago, but no action was taken.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found