>perl -wMstrict -le "my @motifs = qw(WEED KILLD DIAL PIES); my $motif = join '|', @motifs; $motif = qr{ $motif }xms; ;; my $element = 'both WEED PIES and DIAL PIES are present'; ;; my %elements = map { $_ => 1 } $element =~ m{ $motif }xmsg ; ;; printf qq{$_ is %spresent \n}, $elements{$_} ? '' : 'NOT ' for @motifs; ;; my @present = keys %elements; print qq{present: @present}; " WEED is present KILLD is NOT present DIAL is present PIES is present present: WEED DIAL PIES