in reply to Re^2: Why are 5.10's named captures read only?
in thread Why are 5.10's named captures read only?

There are a gazillion variables "free" to choice from, unless you insist on one-character punctuation variables. Frankly, I don't think you need a one-character punctuation variable for this, and
%{^MATCH_OFFSETS}
will do fine. Personally, I'd like the values being arrays of arrays, the inner arrays 2 elements, the index of the start of the match, and the index just after the end of the match. (that is, similar to @- and @+). The outer array will hold as many captures with that name there are, so if you have:
"abc" =~ /(?<l>[a-z])(?<l>[a-z])(?<l>[a-z])/
the result is:
%{^MATCH_OFFSETS} = ('l' => [[0, 1], [1, 2], [2. 3]]);

I'm also pretty sure that if someone write a patch, it will be added to Perl.

Replies are listed 'Best First'.
Re^4: Why are 5.10's named captures read only?
by blazar (Canon) on Oct 20, 2008 at 12:55 UTC

    I personally believe it's clear enough that I don't insist but would certainly like... one-character punctuation variables which are nice, too! ;) I fully second the rest of your suggestion, BTW.

    If %- were not taken, I would have expected it to hold that kind of info. Methods would be the best thing though... I'm playing more and more with autobox but I know it doesn't fit too well in Perl 5's like typical mindset. (Apart the fact that its very docs warn about it not being real autoboxing!) And I don't know how would it square playing with such special variables as the ones we're discussing here...

    --
    If you can't understand the incipit, then please check the IPB Campaign.