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;
In Section
Seekers of Perl Wisdom