in reply to Simple hash problem
Should do the thick,foreach $key ((sort keys %user_hash)[0 .. $x]) {
foreach $key (sort keys %user_hash) { last if $key_count++ > $x; ... }
Update: Abigail is right, the problem is in the sorting. I don't know what the difference will be when you remove the sort from the first method though the second would certainly not take more elements than nessicary.
-- Joost downtime n. The period during which a system is error-free and immune from user input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple hash problem
by Abigail-II (Bishop) on Oct 14, 2002 at 15:06 UTC |