in reply to Hash sorting
Hashes won't preserve order. You can use Tie::IxHash, which sets up a different, order preserving, data structure with hash semantics.
You could keep a sorted array of keys from your hash, instead.
my @key_sorted = sort keys %hash; #or my @val_sorted = sort {$hash{$a} cmp $hash{$b}} keys %hash;
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash sorting
by Limbic~Region (Chancellor) on May 15, 2006 at 12:44 UTC |