- or download this
@union = @intersection = @difference = ();
%count = ();
...
push @union, $element;
push @{ $count{$element} > 1 ? \@intersection : \@difference }
+, $element;
}
- or download this
sub intersection{
my(%count,@res);
...
@res;
}
@a=intersection(\@b,\@c,\@d);