in reply to Using regular expressions on user input w/o while: unitialized value
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: While loop and pattern match (was Re: need help)
by WarrenBullockIII (Beadle) on Jun 05, 2002 at 22:39 UTC | |
by Aristotle (Chancellor) on Jun 06, 2002 at 00:59 UTC |