http://qs321.pair.com?node_id=371768


in reply to Parsing Files for the Interesting Bit

I might do something like:

while ( <FILE> ) { if ( /--- start foo ---/ ) { # we're about to start processing while ( <FILE> ) { last if /--- end foo ---/; # here's a line of stuff to process } # we're done with this block } }

This approach eliminates the conditional, at the risk of not noticing that a file has ended mid block. If that's liable to be a problem, it's a straighforward mod to catch it.