Guay Jean-Sébastien wrote:

>
> There is no problem syntactically. But there is a problem with the
> precdence. If you ever have another operation on either the left or right
> side of the || operator, the || operator will bind tighter than the other
> operation. So for example, if you do:
>
> my $errors = 0;
> open (CRITICALSERVERS, "$crout") || $errors += 2;
>
> that will translate to:
>
> my $errors = 0;
> ( open (CRITICALSERVERS, "$crout") || $errors ) += 2;

Nope.  Please credit the Perl interpreter with some common sense.  There are
few, if any, instances where Perl would override explicit parentheses, and does
not in this case.  To illustrate, I restore the parens to the example I used in
a parallel response:

Greetings! E:\d_drive\perlStuff>perl -w
open (CRITICALSERVERS, 'crout') || die "can't open file \n: $!";
close CRITICALSERVERS;
^Z
can't open file
: No such file or directory at - line 1.

In most cases, Perl will do the right thing with statements expressed in natural
form.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to