in reply to Re: Assigning a varable inside of (?{})
in thread Assigning a varable inside of (?{})

But where the unief was coming from was a blank line in <DATA> ... so the match failed...

No it didn't. Place a "or die qq/failed\n/;" after the regexp and you'll see. While the OP certanly wouldn't ever know if it did or didn't fail (because he doesn't check), when I checked, it's not failing. The real problem is a scoping issue related to when regexes are compiled.

Update:
I do want to congratulate you on zeroing in on the optimal solution, however. I see no good reason to be relying on (?{...}) and $^N, with their inherent difficulties, just to emulate what $1 and $2 do automatically, and without the complexity.


Dave