Help for this page

Select Code to Download


  1. or download this
    @foo = (1, 1, 1, 2, 3, 3, 3, 4, 5, 5, 6, 7, 8, 8,  9, 10);
    my @unique = sort {$a <=> $b} keys({map {$_ => 1} @foo});
    print join(",", @unique) . "\n";
    
  2. or download this
    @foo = (1, 2, 3, 4, 5, 6, 7,  8,  9,  10);
    @bar = (0, 1, 2, 5, 7, 9, 11, 12, 13, 14);
    my @unique = sort {$a <=> $b} keys({map {$_ => 1} (@foo, @bar)});
    print join(",", @unique) . "\n";