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


in reply to Re^2: Sorting The Date format Values without using any perl modules.
in thread Sorting The Date format Values without using any perl modules.

To add to Corion's comment the arrays in your original post and in your follow up are different.

It's hard to help if the question keeps moving!

update: the following is wrong :-(

Each element in your follow up array is the reverse of those in the origninal. (There's a hint in there!)

With that observation and another look at the docs I was able to sort the array in the order you're looking for using the method suggested by Corion.

You didn't say my $sort = (... either.

update 2:

Pursuing the reverse theme, perhaps you could consider an intermediate step:

#!/bin/perl5 use strict; use warnings; use Data::Dumper; my @sort = qw( 05-11-2006 01-01-2005 04-12-2005 22-03-2005 ); my @reversed = map { join '', substr($_, 6), substr($_, 3,2), substr($_, 0,2) } @sort; print Dumper(\@reversed); __DATA__ ---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl $VAR1 = [ '20061105', '20050101', '20051204', '20050322' ]; > Terminated with exit code 0.