I like to use and and not in my code, but as JavaFan pointed out, they have a lower precedence. So I find it best to address this by taking the same approach. I always use a if operator and usually have at least 2 return calls. I find it is clearer what I intended to return as a valid value.
sub done { my $self = shift; return 1 if not $self->foo and not $self->bar; return; }
In reply to Re: Burned by precedence rules
by Herkum
in thread Burned by precedence rules
by vrk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |