in reply to Hash sorting
Unless your hash is huge (like, tens of thousands of keys), it will almost definately be faster to sort the keys each time you want to access it rather than keep a tied hash (or some other custom datatype) in the sort order that you want.my %hash; # use the hash like normal - perl will keep it in whatever # order is the most useful for the runtime foreach my $key (sort keys %hash) { print $hash{$key}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash sorting
by pickledegg (Novice) on May 15, 2006 at 08:19 UTC | |
by davorg (Chancellor) on May 15, 2006 at 08:33 UTC | |
by johngg (Canon) on May 15, 2006 at 08:42 UTC | |
|
Re^2: Hash sorting
by pickledegg (Novice) on May 15, 2006 at 09:00 UTC |