Help for this page

Select Code to Download


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