in reply to ternary conditional help

Hi opaltoot,

tybalt89 already gave you the answer, I just wanted to note you can use B::Deparse to see how Perl interprets your code for yourself (I replaced 1 with $x to prevent optimization):

$ perl -MO=Deparse,-p -e '$x ? $a = 2 : $b = "x";' (($x ? ($a = 2) : $b) = 'x'); $ perl -MO=Deparse,-p -e '$x ? ($a = 2) : ($b = "x");' ($x ? ($a = 2) : ($b = 'x'));

See also Operator Precedence and Associativity.

Although you might want to consider if using the ternary operator like that will help the legibility of the code :-)

Hope this helps,
-- Hauke D