use Regex::PreSuf; my $lineFromSomeTextFile = "your line right here\n"; my @terms = qw/ something matching a line /; my($word) = $lineFromSomeTextFile =~ /(${\presuf(@terms)})/; # or without PreSuf my($word) = $lineFromSomeTextFile =~ do {local $" = '|'; "(@terms)"}; print "found '$word' in: $lineFromSomeTextFile"; __output__ found 'line' in: your line right here
_________
broquaint
In reply to Re: One line assigment statement with regex match
by broquaint
in thread One line assigment statement with regex match
by ketema
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |