Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Sorting hash keys according to different criteria

by Bilbo (Pilgrim)
on Jun 24, 2003 at 15:57 UTC ( #268565=note: print w/replies, xml ) Need Help??


in reply to Sorting hash keys according to different criteria

If you want to put them in order (Jan, Feb, Mar...) you're going to have to tell it what that order is somewhere. I'd have an array:

@months = qw(January February March ... );

Then to access the months in order do

foreach my $month {@months} { print "$month has $days{$month} days\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://268565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2022-05-21 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?