# 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;