http://qs321.pair.com?node_id=165587


in reply to Count of words that match in an array

This is not necesarily the most CPU efficient way...
# Turn at least one of the arrays into a hash (hashes are perfect for +this kind of thing) @Hash1{"A", "B", "C", "D"} = undef; # Then, just use exists... print scalar grep {exists $Hash1{$_}} ("J", "C", "T", "A");