in reply to and or statement
Your question is very unclear. It's hard to tell what you want to obtain. Maybe
my @matches = ( $element =~ /(WEED)/, $element =~ /(DIAL)/, $element =~ /(PIES)/, $element =~ /(KILLD)/, ); if (@matches) { ... }
The above can be shortened by using map as a topicaliser.
if (my @matches = map { /(WEED)/, /(DIAL)/, /(PIES)/, /(KILLD)/ } $ele +ment) { ... }
Update: If you don't mind one of the strings appearing twice if it appears twice in $element, you can use
if (my @matches = $element =~ /(WEED|DIAL|PIES|KILLD)/g) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: and or statement
by ww (Archbishop) on Nov 08, 2011 at 00:36 UTC | |
by endsin1m (Initiate) on Nov 08, 2011 at 01:14 UTC |