| March 2002 | Perl Hardware Store | 33 | 
        while (keys %h < $n) {
          $h{select_thing()}++;
        }
        @things = keys %h;
In scalar context, keys %h is super-efficient.
No, it does not count the keys one at a time.
| Next |  | Copyright © 2002 M-J. Dominus |