Something like this?
use Data::Dumper; sub_with_defaults( { foo => 'real_foo' } ); sub sub_with_defaults { my %DEFAULTS = ( foo => 'default_foo', bar => 'default_bar', ); my %params = ( %DEFAULTS, %{shift @_} ); print Dumper( \%params ); } __END__ $VAR1 = { 'bar' => 'default_bar', 'foo' => 'real_foo' };
In reply to Re: Shorter than ternary?
by kyle
in thread resolved: Shorter than ternary?
by Spidy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |