Hi Monkees,
Why does the following code print 10 bars for the first section, yet behaves as I expected for the second?
#Huh? 10 bars, WTF? for(1..10){ $_>5 ? $x='foo' : $x='bar'; print "$_:$x\n"; } # That's better - 5 foos and 5 bars for(1..10){ $x=($_>5 ? 'foo' : 'bar'); print "$_:$x\n"; }
In reply to Conditional Operator Confusion by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |