Help for this page

Select Code to Download


  1. or download this
    my %tmp = map { $_ => 1} @foo;
    my @uniq_foo = sort keys %tmp;
    
  2. or download this
    my @uniq_foo = sort keys %{ {map { $_ => 1} @foo} };
    
  3. or download this
    my %uniq = map {
        my %tmp = map { $_ => 1} @$_;
        $_ => [sort keys %tmp];
    } keys %arrays;
    
  4. or download this
    my %uniq = map {
        $_ => [sort keys %{ {map { $_ => 1} @$_} }];
    } keys %arrays;
    
  5. or download this
    my %uniq = map {
        my %saw;
        $_ => [map !$saw{$_}++, @$_];
    } keys %arrays;
    
  6. or download this
    my %uniq = map { $_ => [uniq @$_] } keys %arrays;