Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: sorting dates in YYYYMMDD format

by 2teez (Vicar)
on Jul 04, 2013 at 08:17 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1042377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-24 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found