Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: One out of three ain't bad

by strat (Canon)
on Oct 22, 2005 at 05:53 UTC ( [id://502185]=note: print w/replies, xml ) Need Help??

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";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://502185]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found