Help for this page

Select Code to Download


  1. or download this
    my @rows = qw/ 1 2 3 4 1 2 /; # 1 & 2 are dups
    my @non_dupe_rows = do { my %seen;grep !$seen{$_}++, @rows };
    print "@non_dupe_rows\n";
    
  2. or download this
    1 2 3 4
    
  3. or download this
    my @rows = qw/ 1 2 3 4 1 2 /; # 1 & 2 are dups
    my @non_dupe_rows = do {
    ...
        grep $seen{$_} == 1, keys %seen
    };
    print "@non_dupe_rows\n";