in reply to Re: a perl code syntax help
in thread a perl code syntax help
"You cannot insert a conditional statemenent in an such a construction."
I beg to differ!
use strict; use warnings; print <<"END" for 1..100; @{[$_%3?():"Fizz",$_%5?():"Buzz",$_%5&&$_%3?$_:()]} END
For simpler examples, it's even possible to make it sort of legible!
use strict; use warnings; print <<"END" for 1..100; @{[ ($_ % 2) ? 'Odd' : 'Even' ]} END
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: a perl code syntax help
by Discipulus (Canon) on Jul 28, 2014 at 11:31 UTC |