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

Replies are listed 'Best First'.
(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
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