Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: = vs cmp

by mrbbking (Hermit)
on May 27, 2002 at 12:20 UTC ( #169555=note: print w/ replies, xml ) Need Help??

in reply to &lt;=&gt; vs cmp

You can sort names and numbers with sort, and then have pretty clean code:

my $code = 'untested; no Perl on this machine...'; my @numbers = qw (5 6 7 2 4 5); my @names = qw(Larry Randal Tom Jon); @numbers = sort @numbers; @names = sort @names; foreach(@numbers){ print "$_\n"; } foreach(@names){ print "$_\n"; }
...I admit that I may be missing the point, since sort uses <=> internally, by default...

Comment on Re: = vs cmp
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
As of 2014-12-27 01:43 GMT
Find Nodes?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?

    Results (176 votes), past polls