note
TimToady
This gets a little prettier in Perl 6, since it parses the inside of parens as a statement:
<code>
say (if $_ { 'fred' } else { 'bill' }) for 0..1;
</code>
Also, you can usually omit the curlies on a <c>do</c>, if the insides can terminate the whole statement...which it can't if there's a modifier, as above, so we'll invert it:
<code>
for 0..1 {
say do if $_ { 'fred' } else { 'bill' }
}
</code>
Of course, there's also the ternary operator, spelled <c>?? !!</c>, if you want it...
824056
824153