INPUT: while () { for my $match (@list) { next INPUT if /$match/; } print; } #### my $re = join "|", @list; while ... { print unless /$re/; }