go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Oh, just to pre-empt the question, "so why does @- have 6 elements inside of (?&expr) but not outside it", which I suspect is likely to come up. The answer is that effectively the values of $4 and $5 are localized to the scope of the (?&expr) "subroutine", so once the subpattern matches and does its "return" back to the previous context they are reverted to their previous undefined value. Again this is for good reasons, try using a subroutine in a pattern that ISNT defined in a (?(DEFINE) ... ) and play around with it. In that case you very much don't want the use of a named capture as a subroutine to pollute its use as a named capture.
--- $world=~s/war/peace/g In reply to Re^2: Strange behavior of @- and @+ in perl5.10 regexps
by demerphq
|
|