my @words = ( 'foo', 'bar', ); while () { foreach my $word (@words) { if (/\Q$word/) { # BAD!! $word always changes. print; last; } } }