in reply to Processing (from a variable) the 'new' methods hash and storing it to a hash ref
What's the origin of $code? Does this do what you want?
my $info = \%$fun; # or my $info = {}; @$info{ keys %$fun } = values %$fun; [download]