Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Sort on Number Embedded in String

by cog (Parson)
on Mar 22, 2005 at 19:14 UTC ( [id://441575]=note: print w/replies, xml ) Need Help??


in reply to Sort on Number Embedded in String

Untested :-)

for (map { $_->[1] } sort { $a->[0] <=> $b->[1] } map { [substr($_,6,2 +), $_] } @files) { print "fwlog" . $_ . ".Mar2005\n"; }

Update: I didn't notice that some of the lines had only one digit, and not two; hence, my solution with the substr will not work properly. Still, as you can see by the already three similar answers, this (the schwartzian transform) is the right way to go :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-03-28 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found