Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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?
Replies are listed 'Best First'.
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

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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2015-11-30 12:13 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (769 votes), past polls