in reply to Delete all hash keys except for n of them
The call to keys resets the internal hash iterator before each loop, so there shouldn't be any weird surprises with that call to each.delete $hash{ scalar each %hash } while $n < keys %hash;
Seems like a strange problem anyway... Maybe you should also consider using an array instead?
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Delete all hash keys except for n of them
by Anonymous Monk on Oct 25, 2004 at 03:42 UTC | |
by dragonchild (Archbishop) on Oct 25, 2004 at 03:50 UTC | |
|
Re^2: Delete all hash keys except for n of them
by pg (Canon) on Oct 25, 2004 at 03:58 UTC |