Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Sort an array which contains date formatted elements

by salva (Monsignor)
on Jul 17, 2007 at 16:35 UTC ( #627063=note: print w/ replies, xml ) Need Help??


in reply to Sort an array which contains date formatted elements

You can generate multikey sorters easily with Sort::Key:

use Sort::Key::Multi 'iiikeysort'; # the 'iii' stands for three integer keys my (%month, $month); $month{$_} = ++$month for qw(jan feb mar apr ...); @sorted = iiikeysort { /^webadmin_(\w+)_(\d+)_(\d+)\.log$/; ($3, $month{$1}, $2) } @filenames;


Comment on Re: Sort an array which contains date formatted elements
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-09-20 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls