4 ms·
Funnily enough, Perl (since version 5.10) actually has a solution to this. The expression $foo // "default" evaluates to "default" if $foo is undefined, and
by robinhouston 16y ago
Funnily enough, Perl (since version 5.10) actually has a solution to this. The expression
$foo // "default"
evaluates to "default" if $foo is undefined, and to $foo otherwise (even if it is defined but false).