Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: sorting dates in YYYYMMDD format

by 2teez (Priest)
on Jul 04, 2013 at 08:17 UTC ( #1042377=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use re 'debug';
    
    ...
       map [ $_, join('', (/(..)(..)(....)/)[0,1,2]) ],
       @dates;  # DD-MM-YYYY
    print "@sorted\n";
    
  2. or download this
    Compiling REx `(..)(..)(....)'
    size 21 Got 172 bytes for offset annotations.
    ...
    Match successful!
    20130401 20130501 20130601
    Freeing REx: `"(..)(..)(....)"'
    
  3. or download this
    use warnings;
    use strict;
    ...
    print join ' ' => map{$_->[0]}
                  sort{$a->[1] <=> $b->[1]}
                  map{/.{4}(.{2})/;[$_,$1]} @dates;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2015-07-29 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls