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 are DDMMMYYYY.  If you have a DMMMYYYY (like
>2Jul2001), you'll need to pad it with a 0.

I suggest you pad it via a simple

  map { length($_) < 9 ? "0$_" : $_ }

between the bottom map() and @dates.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to