Help for this page

Select Code to Download


  1. or download this
    sub sort_unique_hash {
        my %hash;
        @hash{@_} = ();
        return sort keys %hash;
    }
    
  2. 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)
    
  3. or download this
    @list = qw/foo bar baz foo quack bar baz/;
    
  4. or download this
    @list = ('foo') x 1000;
    
  5. 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)