Help for this page

Select Code to Download


  1. or download this
    my %seen;
    my @union = grep {! $seen{$_}++} @rows, @data;
    
  2. or download this
    my %seen;
    @seen{@data, @rows} = ();
    @data = keys %seen;
    
  3. or download this
    @data = uniq @data, @rows;
    
  4. or download this
    use strict;
    use warnings;
    ...
        listutil => sub {my $f = listutil(\@first, \@second)},
        seengrep => sub {my $f = seengrep(\@first, \@second)},
    });
    
  5. or download this
    ok 1 - They matched.
    ok 2 - They matched again.
    ...
    seengrep 3555/s       --     -16%     -17%
    slice    4233/s      19%       --      -1%
    listutil 4297/s      21%       2%       --
    
  6. or download this
    my @list_A = (1..1000);
    my @list_B = (1..1000);
    ...
            do_something($element_A, $element_B);
        }
    }
    
  7. or download this
    foreach my $row (@rows) {
        push @data, $row unless $row ~~ @data;
    }
    
  8. or download this
    foreach my $row (@rows) {
        my $found = 0;
    ...
        }
        push @data, $row if $found;
    }
    
  9. or download this
    foreach my $element(@data, @rows) {
        $seen{$_} = ();
    }