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

Answer: How do I write my own sorting routine?

by nardo (Friar)
on Jul 05, 2000 at 22:38 UTC ( #21186=categorized answer: print w/replies, xml ) Need Help??

Q&A > sorting > How do I write my own sorting routine? - Answer contributed by nardo

return -1 means $a goes before $b, return +1 means $b goes before $a, return 0 means they are equal.

The "spaceship operator", <=>, returns -1, 0, or 1 depending on whether the left argument is numerically less than, equal to, or greater than the right argument.

Its stringwise counterpart, cmp, returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument.

To learn more about these operators, please read perlop.
To learn more about the sort function, please read perlfunc.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[marto]: no
[marto]: that is to say, to the best of my knowledge, they never did.
[marto]: they have a commercial product called perlapp
[mark4]: Do you h=know how I can get pp.exe? Is there a module I can install that includes this?
[marto]: I always found Strawberry Perl on windows to be a much better environment, made life much easier
[marto]: pp. install it like you would any other module

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2018-01-19 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (218 votes). Check out past polls.

    Notices?