This snippet of Perl code in my program is giving the wrong result.
$condition ? $a = 2 : $a = 3 ; print $a;
No matter what the value of
One suggestion to Tithonium's answer above:
If you are want to assign different values to the same variable, this might be better (the copy-book way):
$a = ($condition) ? 2 : 3;