use Getopt::Std; use vars qw'$opt_f $opt_P $VERSION'; $VERSION = 0.08; unless( @ARGV ){ print<; close(PAT); if( $opt_P ){ REC: while(<>){ #Premature optimization? last unless scalar @PAT; foreach my $i (0 .. $#PAT ){ splice(@PAT, $i, 1) && next REC if /$PAT[$i]/; } print; } print <> unless eof; #Pairs with last unless } else{ REC: while(<>){ foreach my $pattern ( @PAT ){ next REC if /$pattern/; } print; } } __END__ Todo: mmap?