Both your while loop and your pattern match are using $_ implicitly. This line: while (<>) {is equivalent to: while (defined($_ = <>)) {Similarly, if (/foo/) {is equivalent to: if ($_ =~ /foo/) {Change to using an explicit variable and you should be OK. Look at perlsyn for more details.
In reply to Re: While loop and pattern match (was Re: need help)
by VSarkiss
in thread Using regular expressions on user input w/o while: unitialized value
by WarrenBullockIII
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |