my @matches = ( $element =~ /(WEED)/, $element =~ /(DIAL)/, $element =~ /(PIES)/, $element =~ /(KILLD)/, ); if (@matches) { ... } #### if (my @matches = map { /(WEED)/, /(DIAL)/, /(PIES)/, /(KILLD)/ } $element) { ... } #### if (my @matches = $element =~ /(WEED|DIAL|PIES|KILLD)/g) { ... }
## if (my @matches = map { /(WEED)/, /(DIAL)/, /(PIES)/, /(KILLD)/ } $element) { ... } ##
## if (my @matches = $element =~ /(WEED|DIAL|PIES|KILLD)/g) { ... }