if (1 == grep {$_} ($x,$y,$z)) { print "Exactly one variable set\n"; }