use strict; my @expressions = qw(fee fi fo fum); my $expression = join '|', @expressions; while () { chomp; print "$_\n" if /$expression/; } __DATA__ The project was foobar I really fumbled that one I need a vacation Finally! I found the bug This is a sample