Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Sort an array which contains date formatted elements

by salva (Abbot)
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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://627063]
erix just did a 12 km-run. Slow, but unstoppable!
[choroba]: My recent record is 10km in 1 hour :)
[perldigious]: Nice erix... perldigious' legs are so sore from portaging his kayak from place to place last weekend he can barely hobble 12m. :-)
[erix]: you're faster than me then :)
[erix]: well, at the moment, that is :)

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-05-24 12:40 GMT
Find Nodes?
    Voting Booth?