http://www.perlmonks.org?node_id=162026

snafu has asked for the wisdom of the Perl Monks concerning the following question:

So, I was curious about this and looked all over Super Search and google but I am probably forming my search query poorly.

My question is one that I have wondered about for sometime but never pursued out of lack of time. However, I am very curious now to learn how I could do this if at all.

The following code attempt fails:

perl -e ' $a = 5; $b = 5; $c = 5; if ( ($a == $b) == $c ) { print "They are the same\n"; } else { print "They are not the same\n"; } '
Obviously, I had to declare precedence so that the intperpretter wouldn't get confused as to what to compare first then next , but, this still doesn't work. I've tried various other syntactical tweaks in the condition as well but haven't been able to find one that works. I know that you could and or && this but I would like to avoid that if possible.

if ( $a == $b and $a == $c ) { print "true\n"; } else { print "not true"; }
I am thinking that this kind of operation would make it very easy to see if a number of variables all equal the same value which could be done in one condition without extra operators or repeating the lvalue more than once.

_ _ _ _ _ _ _ _ _ _
- Jim
Insert clever comment here...