in reply to Re: using grep to match more than two words
in thread using grep to match more than two words

((grep/^(Sun|Moon)$/, @arr1) == 2) ? (print "True") : (print "False");

This is not reliable if @arr1 is allowed to contain duplicates, it is deemed to give false positives and false negatives, and the OP wrote nothing about that possibility.

Replies are listed 'Best First'.
Re^3: using grep to match more than two words
by parv (Parson) on Jun 13, 2007 at 05:34 UTC

    Oh Dang! I was going to post which would had counted the number of matches (did not post as similar method had already been shown) but I completely missed the possibility of duplicates. Thanks much.