in reply to default values
is easier to read and has the same effect as your code.$val = $default_val if $val eq '';
Does not have the same effect as your code. It will set the default value if $val is false but not necessarily the empty string.$val ||= $default_val;
will print default even though $val is not and empty string;$default_val = "default"; $val = '0'; $val ||= $default_val; print $val;
--
flounder
|
|---|