Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Fastest way to compare multiple variables?

by sierrathedog04 (Hermit)
on May 15, 2001 at 22:03 UTC ( #80652=note: print w/replies, xml ) Need Help??

in reply to Fastest way to compare multiple variables?

if (($a == $b) && ($a == $c) && ($a == $d) ... ){ &do_something }
Update: There seems to be no way to solve this problem without listing each variable by name, since we do not know the names of the variables. So listing them and doing simple equality tests is as maintainable and efficient as other approaches.

A solution that one writes in baby Perl can be just as valid as any other, in the same way that the lyrics to Louie, Louie were as great as those of Dylan's Mr. Tambourine Man, and the Ramones (R.I.P. Joey) were as great as the Beatles.

Replies are listed 'Best First'.
Re: Re: Fastest way to compare multiple variables?
by Anonymous Monk on May 15, 2001 at 23:14 UTC
    I was about to do that, however the TIMTOWTDI / TIMTOWODI spirit hinted me to ask here.

    By the way, what's 'baby Perl'??
      I would define "baby Perl" as any Perl that one can write using only the constructs set forth in the first chapter of Merlyn (Randal L. Schwartz)'s estimable Lhama book "Learning Perl." Thus, one could use print, if, chomp, <STDIN>and even qw and tr but not grep, map, hashes, typeglobs, references and the flipflop operator.

      I say, if you know baby Perl, you can do almost anything, just as if you know a thousand words of French and the present tense conjugations of verbs you can get by in Paris.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://80652]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2018-06-21 20:45 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (119 votes). Check out past polls.