
sleuth
Enthusiast
Dec 12, 2000, 2:43 PM
Post #1 of 1
(7794 views)
|
How Do I Sort A Hash by Either Value Or Key
|
Can't Post
|
|
Here is a good example of how to sort a hashes records by value, please pay attention to the 3rd and 4th posts by myself and rGeoffrey, the first two of mine are BAD coding examples, DO NOT USE THEM. To sort a hash by key, is much more simple, foreach $key (sort keys %hash){ print "sorted key: $key, value: $hash{$key}"; } An excellent article about hashes written by Jasmine the administrator of this site can be found here. Sleuth
|