my %DEFAULTS = ( a => 1, b => 2 ); sub foo { my $arg_ref = shift; my %args = ref $arg_ref eq ref {} ? ( %DEFAULTS, %{$arg_ref} ) : %DEFAULTS; }