Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: testing more than one item for equality

by davido (Cardinal)
on Oct 18, 2006 at 15:52 UTC ( [id://579121]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    if( grep { $_ eq $test } ( $item1, $item2 ) ) {
        #..... This was an "or"
    ...
    if( grep { $_ eq $test } ( $item1, $item2 ) == 2 ) {
        #..... This was an "and"
    }
    
  2. or download this
    use List::MoreUtils qw/ any all /;
    
    ...
        print "True.\n";
        # This one is NOT true, because only one of the three elements mat
    +ched.
    }
    
  3. or download this
    use Quantum::Superpositions;
    
    ...
        print "True.\n";
        # This one fails because only one, not all elements matched.
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found