in reply to Can I match a range from an array?
if (lines05 == m/$a/ - m/$z/) So I can see if there is a match for the entire group instead of doing the logical OR for each scalar which correlates to a pattern? @First, is there a way I can run all 387 lines through a pattern match (like a range) all at once instead of typing "||" for each separate match?rchiav's already given what I consider the clearly appropriate approach, but I thought I'd add that there are ways to do what you asked.
$matched has the number of times $_ was matched by a regex in @regexes, thus neatly being true if it matched 1 or more, and false if it didn't match any.my $str = $_; my $matched = scalar grep { $str =~ /$_/ } @regexes;
|
|---|