Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519160]
help
Chatterbox?
[james28909]: or the act of getting the data that way is called dereference?
[james28909]: sorry for the dumb questions
[james28909]: oh ok, i gotcha
[shmem]: "talking of facts, it is irrelevant what you or I think about them." --Georg C. Lichtenberg
[james28909]: is reference the same as aliasing?
[shmem]: no
[shmem]: aliasing means "accessing the same thing by another name"
[james28909]: this makes sense to me. https://stackoverf low.com/questions/ 14224831/meaning- of-referencing-and -dereferencing
[james28909]: stack overflow
[james28909]: i think im going to ditch perl and learn C

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2018-05-20 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?