![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: Bug or feature? s/// and the g optionby dsheroh (Monsignor) |
on Oct 14, 2007 at 15:39 UTC ( #644762=note: print w/replies, xml ) | Need Help?? |
I'd guess that it's undefined because, in the final example, the last partial match (B...) fails and apparently clears $1 before doing so. Reversing the order of those lines works without returning the warning:
Edit: I poked at it a little more and seem to have confirmed my theory. If the final B in the data string is not followed by C?[DE], $1 ends up undef, regardless of where that B is.
In Section
Seekers of Perl Wisdom
|
|