P is for Practical | |
PerlMonks |
Re: ${^MATCH} sometimes fails in target of substitution?by farang (Chaplain) |
on Jun 16, 2013 at 18:10 UTC ( [id://1039236]=note: print w/replies, xml ) | Need Help?? |
I think this has to do with optimization of the regexp. I may not be using terminology quite right, but Perl sees that the $sub variable can be interpolated, so the regexp is eval'd at compile time, thereby populating ${^MATCH}. That is, it is only after being eval'd once that ${^MATCH} gets the value from the search.
In Section
Seekers of Perl Wisdom
|
|