Line 18 currently looks like this:
$master_ref = ( $master_ref, return_hash_ref() ); # line 18
Change it to one of the two following options:
my $returned = return_hash_ref(); @{$master_ref}{keys %$returned} = values %$returned; # OR my $returned = return_hash_ref(); $master_ref->{$_} = $returned->{$_} for keys %$returned;
If you don't mind changing the underlying reference held by $master_ref (in other words, if nobody else is relying on $master_ref pointing to a specific hashref), you could do this:
$master_ref = { %$master_ref, %{return_hash_ref()} };
But if someone else also holds a reference to the same hash that $master_ref held, that relationship would be broken.
In reply to Re: Return a hashref into another
by Anonymous Monk
in thread Return a hashref into another
by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |