http://www.perlmonks.org?node_id=758665


in reply to Why does the Perl conditional operator not do what I expect?

You should use it like it's shown in the perldoc perlop:

$a = $condition ? 2 : 3; print $a;