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

Re: Sort on Number Embedded in String

by TilRMan (Friar)
on Mar 23, 2005 at 05:06 UTC ( #441689=note: print w/replies, xml ) Need Help??


in reply to Sort on Number Embedded in String

I want to sort on the date.

Try Date::Parse.

use Date::Parse qw( str2time ); sub date { my ($file) = @_; $file =~ /fwlog\.(.*)\.gz/ or warn "Unrecognized filename format"; return str2time($1); } my @sorted = sort { date($a) <=> date($b) } @files;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441689]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-07-20 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (316 votes). Check out past polls.