Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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 <=> 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...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://169555]
help
Chatterbox?
[virtualsue]: weird. my p6 simple web spider fails to extract anchor tags from perlmonks.org
[holli]: Nice. Turns out I don't have to remove Sweet home Alabama from my playlist ;)
[Corion]: virtualsue: We have some links with a newline between <a and the attributes, maybe your extractor fails to handle that?
[virtualsue]: It's not getting any at all, which seems quite broken

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-12-13 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (360 votes). Check out past polls.

    Notices?