Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by wfsp (Abbot)
on Dec 26, 2005 at 15:52 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-26 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found