Help for this page

Select Code to Download


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