in reply to Parsing files then exiting
The simple answer to this is that you need to know when you want to stop printing, and break out of the the read-test-print loop. It looks like you are wanting to stop at the first blank line after you've found the desired data, so try this:
if ($line =~ /$arc/) { $s = 'true'; } # New test here: last if ($s && $line =~ /^[\s\n\r]*$/); if ($s) { print OUTPUT $line; }
This is untested, but I wanted to keep the new code in-line with what you already have.
--rjray
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parsing files then exiting
by ChemBoy (Priest) on Mar 15, 2002 at 01:20 UTC |