Next Program Repair Shop 119

Array Length Variables

     Subject: Re: Sorting is too slow for finding top N keys... - BENCH II
     Message-Id: <lziu9yy6m2.fsf-@linux_sexi.neuearbeit.de>
     $pos=0; $array[$pos++]=
       do { my (@alloc) = 
              ($key, $value, int(rand(1<<16))); \@alloc }
       while(($key, $value) = each %$href);
     push @array, 
       do { my (@alloc) = 
              ($key, $value, int(rand(1<<16))); \@alloc }
       while(($key, $value) = each %$href);
     while(($key, $value) = each %$href) {
       push @array, [$key, $value, int(rand(1<<16))];
     }
     # or perhaps
     @array = map {[$_, $href->{$_}, int(rand(1<<16))]} (keys %$href);


Next Copyright © 2002 M. J. Dominus