in reply to Re: One line assigment statement with regex match
in thread One line assigment statement with regex match
That way will nicely return a list of lines that have at least one of the terms in them. A variant will return a list of terms that are found in at least one line:
It's unclear from the description which of these (or something else) the OP wants.my @matches = grep { my $term = $_; grep{ $_=~/$term/}@lines } @terms;
In Section
Seekers of Perl Wisdom