Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

sort behavior explanation required

by ghosh123 (Monk)
on Apr 20, 2014 at 15:02 UTC ( [id://1082944]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    @arr = ("jack", 80, "martin", 3, "allan", 'george');
    
    ...
    @sort = sort { $a cmp $b } @arr;
    
    print "@sort \n";
    
  2. or download this
    @sort = sort { $a <=> $b } @arr ;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-18 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found