|Do you know where your variables are?|
Sorting hash keys according to different criteriaby Bukowski (Deacon)
|on Jun 24, 2003 at 15:49 UTC||Need Help??|
Bukowski has asked for the wisdom of the Perl Monks concerning the following question:
Just a quick question for the Perlmonks.
I have a hash, with keys being month names and values being number of days in the month.
If I want to print the keys out in a *non-alphabetical* order (if I sort them then I get "April", "August", "December", "February" etc.) particularly the order in which they come in - (Jan to Dec) how can I do this? Or am I going to end up with another hash holding the month, and an integer representation to refer to in the sort?
I know hash entries are effectively random when set up based on memory location, but there must be some trick to ordering the hash keys as I wish.. I had a look at Date::* but nothing lept out at me
Bukowski - aka Dan (firstname.lastname@example.org)