in reply to Re^2: Simple Query on Operators
in thread Simple Query on Operators
Another way to do this is with a separate %DEFAULTS hash that gets mixed in with the arguments passed.
use Data::Dumper; my %DEFAULTS = ( a => 'a default', b => 'b default', c => 'c default', ); my %args = ( a => 'a arg', b => undef, ); %args = ( %DEFAULTS, %args ); print Dumper \%args; __END__ $VAR1 = { 'c' => 'c default', 'a' => 'a arg', 'b' => undef };
Notice that this method keeps a value that exists but is not defined, so somebody can explicitly pass in undef if they want to. This may or may not be what you want.
|
|---|