#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"; }