Looks like it's operator precendence. This works as you expected.
for(1..10){ $_>5 ? ($x='foo') : ($x='bar'); print "$_:$x\n"; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Conditional Operator Confusion
by davorg
in thread Conditional Operator Confusion
by Melly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |