Mornin' Monks !! I come to seek wisdom. I've tried a few different ways to sort a hash table according to the keys in the hash. What I mean specifically is this, If I enter the Keys of my hash like so, they should print out like so:
my %newHoA = ( "Sports" => ["Soccer","UltimateFrisbee","Basketball"], "Books" => ["Cannery Row", "Animal Farm", "East of Eden"], "Places" => ["BigSur","Zion", "CrateLake"] ); foreach my $keyHoA (<sort goes here> keys %newHoA) { print "The key is: $keyHoA" . " And one value is: $newHoA{$req}[0]" . + "\n"; }
So the output should be something like:
Well, I hope some monk out there has the wisdom I seek. Thanks.The key is: Sports And the value is: Soccer The key is: Books And the value is: Cannery Row The key is: Places And the value is: BigSur
UPDATE:
Thank you all for the suggestions. Its helpful to get different perspectives on a single problem.
In reply to How to Sort a Hash According to the Keys in the Hash by ishootperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |