# this is an arrayref or hashref containing # other arrayrefs and/or hashrefs $orig_ref; # this makes a copy of the *reference* to the same data # DOESNT WORK $copy_ref = $orig_reg; # this dereferences, then references the original data # DOESNT WORK $copy_ref = ref($orig_ref) eq 'ARRAY' ? \@{$orig_ref} : ref($orig_ref) eq 'HASH' ? \%{$orig_ref} : undef; # this derefs, copies, then refs the copy # SHOULD WORK BUT DOESNT? if(ref($orig_ref) eq 'ARRAY') { @copy = @{$orig_ref}; # deref the original @copy2 = @copy; # COPY the original data? $copy_ref = \@copy2; # ref the copied data? } elsif(ref($orig_ref) eq 'HASH') { %copy = %{$orig_ref}; # deref the original %copy2 = %copy; # COPY the original data? $copy_ref = \%copy2; # ref the copied data? }