for (1..10) { $x = $_ > 5 ? 'foo' : 'bar'; print "$_:$x\n"; }
Ah, I just noticed that you had tried that in your second example. The real issue that you had was that you were trying to treat a trinary operator like an if-else statement. I have tried that before and it just don't work! :)
In reply to Re: Conditional Operator Confusion
by Herkum
in thread Conditional Operator Confusion
by Melly
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |