Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Sorting an array on two computed fields

by salva (Canon)
on Dec 16, 2005 at 11:25 UTC ( [id://517216]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Sort::Key qw(keysort);
    
    my @array = ( '1-1', '2-5', '2', '6', '1-10', '1-3','2-1');
    
    my @sorted = keysort { pack "N*", split /-/, $_ } @array;
    
  2. or download this
    use Sort::Key::Natural 'natsort';
    my @sorted = natsort @array;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found