for and foreach make the argument an alias to (not a copy of) the values in the list.
Even if you copy a reference, you still get a reference, so I don't understand what you are trying to say.
my $href = {
'x' => {
'y' => {
'z' => [ $xref, $yref, $zref ],
},
#'strange' => { ..... },
},
#'charm' => { .... },
};
for my $obj ( %$href ) {
print "$obj: ",ref($obj),$/;
my $copy= $obj;
print "$copy: ",ref($copy),$/;
}
__END__
prints:
x:
x:
HASH(0x1a65030): HASH
HASH(0x1a65030): HASH
-
tye
(but my friends call me "Tye")