my @pats = ('fo*', 'ba.', 'w+3'); my $pat = join('|', @pats); while (<>) { print if /$pat/o; }