good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: Using ternary operator as lvalue in pushby ikegami (Patriarch) |
on Jul 31, 2007 at 16:37 UTC ( [id://629864]=note: print w/replies, xml ) | Need Help?? |
Youch, that's completely wrong. First of all, the basic idea is wrong. Relational operators (like >) have higher precedence than the conditional operator (?:), so attempting to raise the precendence of > using parens is a no-go. (See perlop.) * Furthermore, you actually made things worse by adding the parens because
Finally, even if done right, the parens don't help. Both
* — You might be thinking of the assignment operators rather than relational operators. Since the conditional operator (?:) has higher precedence than the assignment operators (like =), $cond ? $a = 1 : $b = 1; means ($cond ? $a = 1 : $b) = 1;.
In Section
Seekers of Perl Wisdom
|
|