Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on CoffeeScript -- You Are Totally Gonna Hate It. Parent comment
But you are quite right that Perl if/else are statements and not expressions. Instead you can use the ternary operator:
my $value = $cond == 1 ? 'true' : 'false';
my $value = do { if ($cond == 1) { 'true' } else { 'false' } };
There are no comments on this comment yet.
But you are quite right that Perl if/else are statements and not expressions. Instead you can use the ternary operator:
And because of ditto for Perl you can also do following: