perlfaq nodetype faq_monk <P> Actually, they don't. All <FONT SIZE=-1>C</FONT> operators that Perl copies have the same precedence in Perl as they do in <FONT SIZE=-1>C.</FONT> The problem is with operators that <FONT SIZE=-1>C</FONT> doesn't have, especially functions that give a list context to everything on their right, eg print, chmod, exec, and so on. Such functions are called ``list operators'' and appear as such in the precedence table in [perlman:perlop|the perlop manpage]. <P> <FONT SIZE=-1>A</FONT> common mistake is to write: <P> <PRE> unlink $file || die &quot;snafu&quot;; </PRE> <P> This gets interpreted as: <P> <PRE> unlink ($file || die &quot;snafu&quot;); </PRE> <P> To avoid this problem, either put in extra parentheses or use the super low precedence <CODE>or</CODE> operator: <P> <PRE> (unlink $file) || die &quot;snafu&quot;; unlink $file or die &quot;snafu&quot;; </PRE> <P> The ``English'' operators (<CODE>and</CODE>, <CODE>or</CODE>, <CODE>xor</CODE>, and <CODE>not</CODE>) deliberately have precedence lower than that of list operators for just such situations as the one above. <P> Another operator with surprising precedence is exponentiation. It binds more tightly even than unary minus, making <CODE>-2**2</CODE> product a negative not a positive four. It is also right-associating, meaning that <CODE>2**3**2</CODE> is two raised to the ninth power, not eight squared. <P> Although it has the same precedence as in <FONT SIZE=-1>C,</FONT> Perl's <CODE>?:</CODE> operator produces an lvalue. This assigns <CODE>$x</CODE> to either <CODE>$a</CODE> or $b, depending on the trueness of $maybe: <P> <PRE> ($maybe ? $a : $b) = $x; </PRE> <P>