http://www.perlmonks.org?node_id=742819

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.