Help for this page

Select Code to Download


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