INPUT: while () { for my $match (@list) { next INPUT if /$match/; } print; }