in reply to Cutting the top percentage out of a Hash
The hash is sorted in a specific order,
That's impossible. Hashes can't be sorted, as you've noticed. Are you sure an AoA isn't more appropriate here? If you wish to continue using a hash, the typical solution it the sort the data as you read it from the hash, as follows:
foreach my $key ( sort { ... } keys %lineFinal) { ... }
Alternatively, you could use Tie::IxHash instead of a hash. You use it just like a normal hash (thanks to tie), but the contents are ordered.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cutting the top percentage out of a Hash
by Limbic~Region (Chancellor) on Apr 13, 2006 at 18:49 UTC | |
by Gavin (Archbishop) on Apr 13, 2006 at 19:07 UTC | |
by zshzn (Hermit) on Apr 13, 2006 at 20:59 UTC |