use warnings; use strict; my @names = qw(bob jan mike); while () { my $cnt = 0; for my $name (@names) { $cnt++ if /\b$name\b/i; } print if $cnt == 3; } __DATA__ Mike went to the store with Jan. Jan, Bob and Mike ate lunch. In January, we bobbed for apples and sang into a mike.