RE: Re: A Sort Hash Question

2001-07-03 Thread paul
Thanks Japhy... I can see where you are going with this, we convert the month into a number, and then sort the dates as a string. My dates are the second keys of a hash of hashes. So I have routine like: foreach $firstkey (keys %hoh) { foreach $thedate (keys %{ $hoh { $firstkey }} ) {

Re: A Sort Hash Question

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, Jeff 'japhy' Pinyan said: > @sorted_dates = >map { s/(\d\d)(\d\d)/$1$num2mon{$2}/; $_ } # change MM -> MON >sort# sort the dates >map { s/(\D+)/$mon2num{$1}/; $_ } # change MON -> MM >@dates; > >This assumes your dates

Re: A Sort Hash Question

2001-07-03 Thread Jeff 'japhy' Pinyan
On Jul 3, [EMAIL PROTECTED] said: >My hash has keys that are dates in "ddmmm" format (21Jul2001). The date format DDMM is easily sortable (even via normal 'cmp' comparison). Translate your dates into this format: %mon2num = qw( Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06 Jul 07

A Sort Hash Question

2001-07-03 Thread paul
My hash has keys that are dates in "ddmmm" format (21Jul2001). I would like to sort the hash by date. So as I understand it: keys %dates should return an array with the dates in. I can't sort that directly as it is a date, so I was thinking that I could split the date out and timel