my $regex = join '|', @prims; while(<>){ print "Found item in $_" if m/$regex/; }
If you wan the items in the array not to be interpreted as regexes, you have to use
my $regex = join '|', map quotemeta, @prims;
In reply to Re: Pattern match array
by moritz
in thread Pattern match array
by aennen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |