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

Re: Fastest way to compare multiple variables?

by Masem (Monsignor)
on May 15, 2001 at 21:14 UTC ( #80624=note: print w/ replies, xml ) Need Help??


in reply to Fastest way to compare multiple variables?

TIMTOWODI:

if ( !grep { $_ != $a } ($b, $c, $d, $e...) ) { &do_something }

Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain


Comment on Re: Fastest way to compare multiple variables?
Download Code
Re: Re: Fastest way to compare multiple variables?
by Anonymous Monk on May 15, 2001 at 21:31 UTC
    Thank you for the suggesting code... it works well without using temporary arrays/hashes.

    By the way, what does TIMTOWODI mean?
      TIMTOWTDI - There Is More Than One Way To Do It
      TIMTOWODI - There Is More Than One Way Of Doing It
(ar0n) Re (2): Fastest way to compare multiple variables?
by ar0n (Priest) on May 15, 2001 at 21:55 UTC
    if ( @list == grep { $_ == $list[0] } @list ) { &do_something; }
    ... seems clearer to me. But then again, that's just me ;)

    ar0n ]

      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://80624]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2015-07-07 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls