in reply to adding to a hash

Flame me if it's already told before :-) I couldn't find it.

How about returning a reference to your %temp_vars and adding your new variables like this:
# This would be the return statement of get_page_content return \%temp_vars; # And this would be the call: $new_variables = get_page_content("names"); # $new variables is a reference to your result @variables{keys %$new_variables}=values %$new_variables;
Of course this will overwrite all variables that exist in both %tempvars and %variables with the value found in %temp_vars.