I ran your code through Deparse, and this is what I got:
$ perl -MO=Deparse,-p print $lines > 1 ? 'plural' : 'singular'; print ($lines > 1) ? 'plural' : 'singular'; __END__ print((($lines > 1) ? 'plural' : 'singular')); (print(($lines > 1)) ? '???' : '???'); - syntax OK
While in the first line all that follows print is print's argument, in the second line only $lines > 1 is the argument
So, besides the precedence rules cited by jsprat and stephen, you should remember another rule I found somewhere in the Camel Book:
if it looks like a function, it is a function
that is: if you enclose something in parentheses just after a function, e.g. print, what's enclosed in parentheses is considered that function's argument
Ciao!
--bronto
# Another Perl edition of a song:
# The End, by The Beatles
END {
$you->take($love) eq $you->make($love) ;
}
In reply to Re: What difference do the brackets make?
by bronto
in thread What difference do the brackets make?
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |