Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: multiple checks on a conditional

by rchiav (Deacon)
on Aug 28, 2001 at 20:35 UTC ( #108496=note: print w/replies, xml ) Need Help??


in reply to multiple checks on a conditional

Actually, it won't evaluate the regex if the first half of the "and" is false. For a test, try..
#!/usr/bin/perl -w use strict; if ( (0) and (print "test\n")) { print "True\n"; }
"test" won't print. If you chage the 0 to a 1, it will. The reason being is that for an "and" to be true, both parts have to be true. If the first half is false, there's no need to evaluate the second half.

Hope this helps
Rich

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2021-09-27 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?