use List::Util qw[ first ]; my @terms = ( 'foo bar', 'blah' ); my $term = 'foo'; my $match = first{ /\Q$term/ } @terms; print $match; foo bar
In reply to Re: regex to return matched value from array
by BrowserUk
in thread regex to return matched value from array
by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |