my $val ||= "undefined"
Which is equivalent to:
if (!$val) { $val = "undefined"; }
Blocks of code like that tend to clutter up your code.
Also consider:
$val = ($val) ? "defined" : "undefined";
Which is equivalent to:
if ($val) { $val = "defined"; } else { $val = "undefined"; }
Also, remember perl evaluates expressions for truth.
In reply to Re: shift and logical or
by mhearse
in thread shift and logical or
by jonagondos
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |