Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

How do you say %+ in English?

by jaldhar (Vicar)
on Feb 10, 2009 at 16:58 UTC ( #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?

--
જલધર

Comment on How do you say %+ in English?
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.

Re: How do you say %+ in English?
by ikegami (Pope) 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

Log In?
Username:
Password:

What's my password?
Create A New User
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? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-07-10 03:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls