my $count = 0; $x && $count++; $y && $count++; $z && $count++; if($count == 1) { print "Exactly one variable set\n"; }