in reply to Re: Default named params with an embedded hash
in thread Default named params with an embedded hash
Hello Ea,
Using hash slices is a clever strategy here!, and the Modern Perl link is a useful one. I must admit, I’m still trying to get my head around the @{ ... }{ ... } syntax, which is perfectly correct, but looks wrong (to me).
But this:
$params{max_record_length} = $hash{max_record_length} || $params{max_record_length};
makes it impossible to override $params{max_record_length} with a zero value. Easily fixed:
$params{max_record_length} = $hash{max_record_length} // $params{max_record_length};
See perlop#Logical-Defined-Or.
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|