Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: = vs cmp

by ariels (Curate)
on May 27, 2002 at 11:04 UTC ( #169543=note: print w/ replies, xml ) Need Help??


in reply to <=> vs cmp

You can sort with cmp instead of <=>; the question is if you'll like the results.

DB<1> x sort { $a cmp $b } 1..10 0 1 1 10 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 DB<2> q


Comment on Re: = vs cmp
Download Code
Re: Re: = vs cmp
by Jasper (Chaplain) on May 27, 2002 at 11:11 UTC
    whoops! I obviously am as stupid as I look. Didn't really notice this because all my ints are pretty much the same length, and the sorting by int gives fairly randomised results, anyway. Actually, I could zero-fill my script generated numbers, and store them that way.. That way I'd get the speed of sorting using cmp, and slightly simpler code.

    Hmmm, goes off and thinks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-09-22 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (178 votes), past polls