Help for this page
Use a hash. Here's code to do both and more. It assumes that each elem +ent is unique in a given array: ... push @{ $count{$element} > 1 ? \@intersection : \@difference } +, $element; } Note that this is the symmetric difference, that is, all elements in e +ither A or in B but not in both. Think of it as an xor operation.
$_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s, $_^=q,$\^-]!,,print