This says if $val has any value that isn't false, leave it alone - else set it to $default_val. The problem arises if $val evaluates to false (0, "", "0", undef). If you don't care about those cases, you can shorten it.$val ||= $default_val;
Cheers - L~R
In reply to Re: default values
by Limbic~Region
in thread default values
by wolis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |