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


in reply to Conditional Operator Confusion

You may like:

for(1..10){ $x= $_ > 5 && 'foo' || 'bar'; print "$_:$x\n"; }

instead. Update: You may like:

print"$_:${[$_>5&&'foo'||'bar']}[0]\n"for 1..10;

even better.


DWIM is Perl's answer to Gödel