http://www.perlmonks.org?node_id=587233


in reply to ?: = Obfuscation?

If the test is really short, you can make tables with either if/else or ?:
if ( $score >= 90 ) { $grade = 'A'; } elsif ( $score >= 80 ) { $grade = 'B'; } #... else { $grade = 'F'; }
$grade = ( $score >= 90 ) ? 'A' : ( $score >= 80 ) ? 'B' : ( $score >= 70 ) ? 'C' : ( $score >= 60 ) ? 'D' : 'F';
Both of these degrade badly as the line length grows.

But, even if you like ifs (which I do mostly), tables are better than:

if ( $score >= 90 ) { $grade = 'A'; } elsif ( $score >= 80 ) { $grade = 'B'; } #...

Phil