Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Code blocks with ternary operator or trailing conditionalsby Anonymous Monk |
on Feb 09, 2014 at 09:08 UTC ( [id://1074098]=note: print w/replies, xml ) | Need Help?? |
Just use an if...else. The ternary operator is not meant for full statements.
If I had to put them all on a single line, I'd use something like this, but you'll have to be careful of false values: ...That's awful in terms of style, though. Just use an if statement.
In Section
Seekers of Perl Wisdom
|
|