Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 pondering the Monastery: (13)
As of 2014-09-02 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls