@lines will hold all the lines of the file 'input.txt' that match any of the phrases in @latin_am@latin_am=("Ecuador","Mexico"); $regex = join ("|", @latin_am); open( FILE, 'input.txt' ) or die "input.txt: $!"; @lines = grep { /$regex/o } <FILE>;
In reply to Re: matching an array of alternates
by perlmonkey
in thread matching an array of alternates
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |