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


in reply to Re: Strange behavior of @- and @+ in perl5.10 regexps
in thread Strange behavior of @- and @+ in perl5.10 regexps

Hmm, probably not documented directly and might not be tested explicitly. But certainly indirectly. We have lots of tests that $1 and friends behave "as expected" inside of (?{ ... }) and (??{ ... }) blocks. So effectively that means that @- and @+ have to as well, as they are all just ties into the same C level data structures.

Now, at a certain level these constructs are still documented as experimental or subject to change so technically you have a point, and I appreciate that you pointed this out.

But I personally would/do see problems with the magic variables inside of these constructs as a bugs, the experimental status just says I get to change my mind if I want. :-) However in this case things are working pretty much exactly as planned, with the possible nit as to whether (?<expr> ... ) should have a slot allocated to it that never gets used. Which is mostly irritating as it is wasteful, and a little counter-intuitive, but actually expected behaviour.

---
$world=~s/war/peace/g

  • Comment on Re^2: Strange behavior of @- and @+ in perl5.10 regexps