Thx, operator precedence is sometimes a PITA
If the precedence was reversed, the intended use would not work.
would mean$y = $c ? $x1 : $x2;
($y = $c) ? $x1 : $x2;
By the way, it's called the "conditional operator". Perl has many ternary operators.
In reply to Re^3: Question about ternary operator
by ikegami
in thread Question about ternary operator
by merlinX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |