Re: Sorting year and month

2005-03-02 Thread Sherm Pendley
On Mar 2, 2005, at 12:14 AM, John Horner wrote: @data = sort { $a-{year} = $b-{year} || $months{ $a-{month} } = $months{ $b-{month} } } @data; ## only if the years are equal does the second sort take place, is that right? Yes - when you use ||, it short circuits the expression if

Re: Sorting year and month

2005-03-01 Thread Sherm Pendley
On Mar 1, 2005, at 2:48 AM, Mark Wheeler wrote: Hi Sherm, That works perfectly. Could you give me a brief rundown on how the sort works with Date::Manip, so I can understand what is going on? On Feb 28, 2005, at 1:03 AM, Sherm Pendley wrote: my @sorted = sort { Date_Cmp(ParseDate($b),

Re: Sorting year and month

2005-03-01 Thread Mark Wheeler
Hi Sherm, Thanks for taking the time to explain it. That makes sense. Mark On Mar 1, 2005, at 12:59 AM, Sherm Pendley wrote: On Mar 1, 2005, at 2:48 AM, Mark Wheeler wrote: Hi Sherm, That works perfectly. Could you give me a brief rundown on how the sort works with Date::Manip, so I can

Re: Sorting year and month

2005-03-01 Thread John Horner
I was interested by this question -- and let me say, of course the correct answer is, use the module -- I just took the opportunity to try learn a bit about more advanced sorting. The following is of course a very roundabout solution, but it shows how you can sort by an arbitrary quality you

Sorting year and month

2005-02-28 Thread Mark Wheeler
Hi, I have a quick question regarding sorting. I have a list of dates and years in the following format: October-2004 December-2004 September-2004 January-2005 November-2004 I need to sort them so the final outcome is: January-2005 December-2004 November-2004 October-2004 September-2004 Of

Re: Sorting year and month

2005-02-28 Thread Mark Wheeler
Hi Sherm, That works perfectly. Could you give me a brief rundown on how the sort works with Date::Manip, so I can understand what is going on? Thanks, Mark On Feb 28, 2005, at 1:03 AM, Sherm Pendley wrote: On Feb 28, 2005, at 3:41 AM, Mark Wheeler wrote: I have a quick question regarding