Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: natural sort on array of arrays

by duelafn (Parson)
on May 10, 2016 at 16:54 UTC ( [id://1162647]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @sorted_matrix = sort { natural_cmp($a->[0], $b->[0]) } @matrix;
    
    ...
      my ($x,$y) = map { my $key = $_; $key =~ s[(\d+)][ pack "N", $1 ]ge;
    + $key } @_;
      $x cmp $y;
    }
    
  2. or download this
    0 0 -> A1a1
    1 0 -> A1a12
    2 0 -> A10a1
    3 0 -> A12a1
    

Log In?
Username:
Password:

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

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

    No recent polls found