in reply to Surprised by Perl parse of ternary operator
Running this line of code through MO=Deparse produced the same output.
Add -p to show the precedence:
c:\test>perl -MO=Deparse,-p -e"$fred == 42 ? $config = 'k1' : $config += 'k2';" ((($fred == 42) ? ($config = 'k1') : $config) = 'k2'); -e syntax OK
(And yes. It's weird :)
|
|---|