in reply to Using expressions in arrays for pattern matching
The following demonstrates a way that you can handle the multiple selection criteria:
use strict; my @expressions = qw(fee fi fo fum); my $expression = join '|', @expressions; while (<DATA>) { 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
The pipes added in the join statement let you do 'or's in your regular expressions.
As a side note, there is nothing wrong with globbing, but you may want to check out the File::Find module.
|
|---|