Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Sort on Number Embedded in String

by Roy Johnson (Monsignor)
on Mar 22, 2005 at 19:15 UTC ( [id://441581]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print "$_\n" for map {$_->[1]}
                     sort { $a->[0] <=> $b->[0] }
                     map {[/(\d+)/, $_]} @files;
    
  2. or download this
    print "$_\n" for sort {
          my ($ad, $bd) = map /(\d+)/, ($a, $b);
          $ad <=> $bd
    } @files;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found