in reply to Regular expressions to store matching patterns in an array.
in thread How can I place each "word" of a string in a varible if I don't know the length of the string?

Is it possible to do the opposite? Make an assignment of one scalar if a match is found in the elements of an array? I'm sure this syntax is wrong, but something like:
@terms = ("Word1","Word2","Word3"); $match = $1 if($lineFromSomeTextFile =~ /(^@terms)/);
I know the regular expression part is wrong, but is there some advanced Monk way of accomplishing this? What about grep? can that somehow be incorporated into the regex?

Replies are listed 'Best First'.
Re^2: Regular expressions to store matching patterns in an array.
by planetscape (Chancellor) on Jun 23, 2005 at 18:21 UTC