sub initialize_with_pars { my $self = shift; # Alternative 1: a,b can be overwritten by AVPs given in @_ %{$self} = (%{$self}, 'a' => 10 , 'b' => 20, @_); # Alternative 2: init. of a,b has priority over AVPs from @_ # %{$self} = (%{$self}, @_, 'a' => 10 , 'b' => 20); } ... # Usage: $self->initialize_with_pars; # or $self->initialize_with_pars( 'c' => 30 );