--- Michael Kelly <[EMAIL PROTECTED]> wrote:
<snip>
> Only and's short-circuit. Or's test every argument by necessity.
<snip>

Mike,

In just about every Perl script that has to read from or write to a
file, you will see a line similar to the following:

open (MYFILE, "myfile.txt") or die "Can't open myfile.txt: $!\n";

This is an conditional statement using an "or".  If your statement was
correct, both the open clause and the die clause would be executed and
the program would never get beyond this point.  But what actually
happens in most instances is that the open statement succeeds and
returns a value that evaluates to true.  An or statement is true if at
least one of its clauses is true.  So if the open clause is true, Perl
does not bother checking the other clause, the die statement is skipped
over, and the program continues running.

RobR





__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to