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
In reply to Re: Parsing files then exiting
by rjray
in thread Parsing files then exiting
by rscott212
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |