[tpm] Stupid question time!

Fulko Hew fulko.hew at gmail.com
Fri Jan 29 13:05:33 PST 2010


On Fri, Jan 29, 2010 at 3:55 PM, Madison Kelly <linux at alteeve.com> wrote:

> What is the difference between:
>
> if (not $foo && $bar ne "") {}
> if ((not $foo) && ($bar ne "")) {}
>
> I assumed it was mainly an aesthetic/readability thing, but I realize that
> no, it's logically different. Thanks for enlightening me?
>

Read the perlop document on operator precedence.  I see that:

ne binds first
&& binds second
and not has the lowest precedence

I think you expected it to be 'just as high' as the 'ne'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20100129/170cd27e/attachment.html>


More information about the toronto-pm mailing list