Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

(ar0n) Re (2): Fastest way to compare multiple variables?

by ar0n (Priest)
on May 15, 2001 at 21:55 UTC ( #80650=note: print w/ replies, xml ) Need Help??


in reply to Re: Fastest way to compare multiple variables?
in thread Fastest way to compare multiple variables?

if ( @list == grep { $_ == $list[0] } @list ) { &do_something; }
... seems clearer to me. But then again, that's just me ;)

ar0n ]


Comment on (ar0n) Re (2): Fastest way to compare multiple variables?
Download Code
Re: (ar0n) Re (2): Fastest way to compare multiple variables?
by MeowChow (Vicar) on May 15, 2001 at 23:03 UTC
    if ( !grep $_ != $list[0], @list ) { &do_something; }
    ... probably clearer, definitely probably faster :)
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-09-22 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (206 votes), past polls