my @regs =( qr/split/ , qr/se.d/ , qr/open/, qr/print/, # might be another 100 in here # ); my @bar; my @foo; push @foo, "still empty"; open INP , "<../IPutils.pm"; #random code while (){ push @bar, $_; } print @bar, "\n--EOD-----------\n"; @foo = grep{ # !/^\s*#/ #sample from Perldocs #{ #causes compile error #( #causes compile error my $final =1; #default true foreach my $r (@regs){ $final = 0 if ( $r ); #match means drop this line } $final; #last value of the block hmmmmm #) #} }@bar; print @foo;