http://qs1969.pair.com?node_id=481991


in reply to Algorithm for cancelling common factors between two lists of multiplicands

If the arrays don't contain duplicate elements:

$c{$_}++ foreach @a; $c{$_}++ foreach @b; @c = grep { $c{$_} != 2 } @a; @d = grep { $c{$_} != 2 } @b;