in reply to Reading entire file.
I'll just latch onto one of your questions:
>Is there an easier way to test and print between two points in a file,
Yes, there is. I tried to explain it in from...to
In your case, I'd recommend you break out of the loop after you're finished with the tool:
while (<FOO_FILE>){ if (/$foo/){ $that = 1; } if (/$bar/){ last; # emergency exit from the loop ;-) } if ($that){ print $_; } }
You could also seperate it into two loops, one for searching for the tool, one for reading the lines for that tool.
while (<FOO_FILE>){ last if /$foo/; # ignore all lines until we find foo } while (<FOO_FILE>){ last if /$bar/; print $_; # do something with the lines we find now } close FOO_FILE; # just ignore the rest of the file
-- Brigitte 'I never met a chocolate I didnt like' Jellinek http://www.horus.com/~bjelli/ http://perlwelt.horus.at
|
|---|
| Replies are listed 'Best First'. |
|---|