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
    ehehe i had some precognition when i wrote that..
    Better i would say: 'I tried but it was a...' but in Perl many many things are possible!

    Thanks tobyink
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.