http://www.perlmonks.org?node_id=268599


in reply to Sorting hash keys according to different criteria

Depending on what you're doing with this you might find an array of hashes useful. This would give you the data in the fixed order ordained by the calendar - you could then pull it out however you liked, and even have a framework for adding more info.
my @months = ( { name => "January", days => 31, }, { name => "February", days => 28, # or whatever... there's another prob },
etc etc etc

You could then use the month number returned by localtime to pull data out of this array.

Having said that, if you're doing a lot of date calculations, then half an hour rummaging around in CPAN would probably save you time.

George Sherston