- or download this
sub sort_unique_hash {
my %hash;
@hash{@_} = ();
return sort keys %hash;
}
- or download this
Benchmark: timing 100000 iterations of foreach, hash...
foreach: 14 secs (13.50 usr 0.00 sys = 13.50 cpu)
hash: 6 secs ( 5.85 usr 0.00 sys = 5.85 cpu)
- or download this
@list = qw/foo bar baz foo quack bar baz/;
- or download this
@list = ('foo') x 1000;
- or download this
Benchmark: timing 1000 iterations of foreach, hash...
foreach: 12 secs (11.82 usr 0.00 sys = 11.82 cpu)
hash: 1 secs ( 0.88 usr 0.00 sys = 0.88 cpu)