in reply to Count of words that match in an array

grep {$x=$_;grep{$_ eq $x} @ar1} @ar2;