in reply to Don't re-read file for each new pattern...
@strings is a variable stored in memory that contains the lines of FILE (one line per position in the array)
The infinite while asks for an input pattern, the only way of exiting from it is "typing" an empty pattern (i.e. /^\s*$/). Because the program doesn't know when the user will enter an empty pattern, it iterates forever checking if the pattern is empty.
citromatik
UPDATE: Of course, TIMTOWTDI:
perl -e 'while (<>!~/^\s$/){print "Not empty\n"}'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Don't re-read file for each new pattern...
by cgmd (Beadle) on May 30, 2007 at 15:41 UTC | |
by citromatik (Curate) on May 30, 2007 at 17:06 UTC | |
by cgmd (Beadle) on May 30, 2007 at 23:34 UTC |