|< 1 2 >| | 19 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
my @sorted = sort @array;
my @clean = ();
my $before = undef;
foreach (@sorted) {
push @clean, $_ if (not defined $before) or ($_ ne $before);
$before = $_;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use warnings; use strict; my @array = <>; my @uniq= map { $_->[0] } grep { ! $_->[1] } sort { my $v = $a->[0] cmp $b->[0]; $a->[1] = 1 unless $v or $b->[1]; $v } map { [$_] } @array; print @uniq;
1 2 3 4 5 6 7 8 9 10
use strict; use warnings; my @array = <>; my @uniq; my %hash; for (@array) { push @uniq, $hash{$_} = $_ unless exists $hash{$_}; } print @uniq;
|< 1 2 >| | 19 Einträge, 2 Seiten |