Help for this page

Select Code to Download


  1. or download this
    my %count; $count{$_}++ for @temp;
    my @non_unique_intersection = grep { $count{$_}-->0 } @temp2;
    
  2. or download this
    # my @non_unique_intersection = nonunique_intersect( \@temp, \@temp2 )
    +;
    
    ...
      my @return = grep { $count{$_}-->0 } @$y;
      return wantarray ? @return : \@return;
    }
    
  3. or download this
    my %count; $count{$_}++ for @temp;
    my @non_unique_intersection = grep { $count{$_}-->0 } @temp2;
    my (@leftovers, @leftovers2);
    push @{$count{$_}>0 ? \@leftovers : \@leftovers2}, ($_) x abs($count{$
    +_}) for keys %count;