in reply to sorting by quarterly calendar
Well, an easy way to do it would be to map the month to a quarter with an array:
Just to clarify, the split breaks up the date strings into components at forward slashes, and the [0] pulls out the month part.my @quarter = qw(q0 q3 q3 q4 q4 q4 q1 q1 q1 q2 q2 q2 q3); # Later... @sorted = sort { $quarter[(split(/\//, $a))[0]] cmp $quarter[(split(/\//, $b))[0]] } @rawdates;
Note: I'm assuming all the dates are in the same year, although it shouldn't be hard to extend this to sort on year also.
HTH
|
---|