Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Sorting two dimensional arrays

by toonski (Beadle)
on Aug 16, 2003 at 22:34 UTC ( #284370=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      @myarray = (
                   ['one','two','three','four'],
                   ['first','second','third','fourth'],
                   ['jim','bob','bill','sally'],
                 );
    
  2. or download this
      @myarray = sort {$a->[$n] cmp $b->[$n]} @myarray;
    
  3. or download this
      my @arraylist = sort {$myarray[$a] cmp $myarray[$b]} 0..$#myarray;
      for $listitem (@arraylist) {
        print $myarray[$listitem];
      }
    
  4. or download this
      for $listitem (@arraylist) {
        print $myarray[$listitem][0] . "<br>";
        print $myarray[$listitem][1] . "<br>";
        print $myarray[$listitem][2] . "<br>";
      }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://284370]
Approved by graff
Front-paged by hsmyers
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2022-05-17 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (65 votes). Check out past polls.

    Notices?