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.
In reply to Re: Conditional Operator Confusion
by GrandFather
in thread Conditional Operator Confusion
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |