Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Sorting The Date format Values without using any perl modules.

by wfsp (Abbot)
on Dec 26, 2005 at 15:52 UTC ( #519160=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^3: Sorting The Date format Values without using any perl modules.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519160]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-07-25 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls