in reply to passing a hash ref in a sub
Is the question for the sake of understanding reference and sub-routine? If not, the code is basically just merging one hash to another.
my $result_hr = { %$data }; [download]