- or download this
foreach my $e (@array1, @array2) {
$union{$e}++ && $intersect{$e}++
}
- or download this
my @sets = (\@array1, \@array2, ...);
for my $i (0..$#sets) {
...
compute_stuff($sets[$i], $sets[$j]);
}
}
- or download this
sub union_intersection {
my ($set1, $set2) = @_;
...
for my $e (@$set1, @$set2) { ... }
...
}