sub isbeg { my $test = shift; foreach (@beginnings) { return 1 if $test =~ /$_/ } return; } sub isend { my $test = shift; foreach (@endings) { return 1 if $test =~ /$_/} return; } #### foreach my $line (@lines) { push @extracted, $line if isbeg($line) .. isend($line); last if isend($line); }