Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Sort an array which contains date formatted elements

by moritz (Cardinal)
on Jul 17, 2007 at 12:35 UTC ( #627014=note: print w/replies, xml ) Need Help??

in reply to Sort an array which contains date formatted elements

You should transform the filenames to something that can easily be compared:

my %month = ( jan => 1, feb => 2, ... ); m/webadmin_([^_]+)_(\d+)_(\d{4})\.log/; my ($month, $day, $year) = ($1, $2, $3); my $new_filename = sprintf "%04d-%02d-%02d", $year, $month{$month}, $d +ay;

You can combine that with a Schwartzian Transform.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://627014]
[Corion]: LanX: The command is always in the history if you typed it in before. If you didn't type the command into the command line, it will not be there. I think there is doskey which can stuff command lines into the history
LanX damns the cult of CB ;-)
[LanX]: please forget my last 3 posts
[LanX]: Yeah option a doesn't go into history
[LanX]: probably I need to teach the app to restart after C-c Kill
[Corion]: LanX: Maybe have an infinite-loop cmd file? Much easier than trying to manage that from within Perl IMO
[Corion]: Alternatively, relaunch the application from cron (or a Windows cron) every minute
[LanX]: will try infinite loop ...
[Corion]: :START ... goto START

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2017-03-27 15:52 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.