Perl has a logical xor operator but it happens to be at the very bottom of the precedence priority list , importantly below the humble comma. So this innocent looking piece of code:
foobar( $a xor $b, $c );
Is interpreted as:
foobar( $a xor ($b, $c) );
And note unlike the not, and and or low-precedence logical operators,Â there is no high-precedenceÂ xor operator.
So it’s a good idea to wrap xors in parentheses to guarantee intended behaviour:
foobar( ($a xor $b), $c );