package whatever; ... sub add_condiment { my $obj = shift @_; $obj->set_property("add", "condiment", "cheeze"); } sub add_color { my $obj = shift @_; $obj->set_property("add", "favoriteColor", "blue"); } sub set_property { my $obj = shift @_; my $action_type = $_[0]; my $property_type = $_[1]; my $item = $_[2]; if( $action_type =~ m/add/i && exists $obj->{'properties'}->{"$property_type"} ) { push @{$obj->{'properties'}->{'$property_type'}}, $item; } elsif( $action_type =~ m/remove/i && exists $obj->{'properties'}->{"$property_type"} ) { ## loop over the items till you find what you want to ## remove, then remove it } else { die "Something unplanned happened"; }