Do you know where your variables are? | |
PerlMonks |
Re: $1 don't reset (non loop)by MCS (Monk) |
on Feb 17, 2004 at 13:23 UTC ( [id://329583]=note: print w/replies, xml ) | Need Help?? |
Why doesn't $1 reset when the regexp doesn't match anything? It's a feature, not a bug :-) Actually there are times when it comes in handy, if I'm doing stuff where I need it to be redefined I usually use an if {} elsif{} else{} loop. That way it only goes into the {} if the if (or elsif) matches. If you don't want to use an elsif (because you are checking a few things) just use multiple if statements.
In Section
Seekers of Perl Wisdom
|
|