in reply to Slurp multiple lines to a variable
If you don't want to read the entire file into memory, how about
my @out; while(<F>) { push @out, $_ if /StartPattern/.../StopPattern/; } [download]