- or download this
$x = 0;
$y = 1;
$z = 0;
- or download this
$x = 5;
$y = undef;
$z = 5;
- or download this
my $count = 0;
$x && $count++;
...
if($count == 1) {
print "Exactly one variable set\n";
}
- or download this
if((grep { $_ } $x, $y, $z) == 1) {
print "Exactly one variable set\n";
}