if($x && !$y && !$z or !$x && ($y xor $z)) { print "Exactly one variable set\n"; }