Running this with perl -MO=Deparse,-p gives:
(($condition ? ($a = 2) : $a) = 3);So your problem is operator precedence. You should parenthize the assignments. (The ternary operator is often found on the right-hand side of an assignment, so it has higher precedence.)
In reply to Re: Why does the Perl conditional operator not do what I expect?
by betterworld
in thread Why does the Perl conditional operator not do what I expect?
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |