Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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.


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 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?
Username:
Password:

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

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

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (113 votes), past polls