Symbolic xor
Why doesn’t Perl have a symbolic logical xor operator (spelled “^^”)? As far as I can tell, the only reason is that C doesn’t have one...
At a minimum,
it would remove the need for parentheses in expressions like
$flag =
($subflag1 xor $subflag2);
instead allowing
$flag = $subflag1
^^ $subflag2;
…like you can now do with and and or, as long as you spell them “&&” and “||”.
Would I use this a lot? No. (I would have for maybe the 2nd time yesterday, which is what made me think of it.) But as someone who loves completeness, the absence of a symbolic xor absences from Perl has always bothered me.
Leave a comment