Ilya (>):
> look like bug (in r31017):
>
> my $k = 'bar';
> my %s;
> say defined $k; # 1
> say defined %s{$k}; # 0
> say defined $k and defined %s{$k}; # 1 (!) must be 0
> say 1 && 0; # 0

No, this is intended. "and" has very loose precedence, even looser
than the "say" call. The crucial statement is thus parsed like this:

(say defined $k) and defined %s{$k};

...which would output 1 but return 0.

To learn more about operator precedence, see

 <http://perlcabal.org/syn/S03.html#Operator_precedence>

Also check out the excellent "perldoc perlop" for Perl 5 for more
examples of this.

 <http://perldoc.perl.org/perlop.html>

// Carl

Reply via email to