Copy contents of reference

F

Frank

Hi,

Is it possible to copy the contents of a scalar/hash/array-reference to
a scalar/hash/array variable?

I have this script:

use Data::Dumper;
my $save_ref;
my @save_arr;
my @array = ("one","two","three");

$save_ref = \@array;
@save_arr = $save_ref;
print Dumper(@save_arr);

@array = ();

print Dumper(@save_arr);


And the end I want @save_arr to be 'disconnected' from anything leading
back to the original @array.


Regards,

Frank
 
G

Glenn Jackman

At 2006-02-27 07:27PM said:
And the end I want @save_arr to be 'disconnected' from anything leading
back to the original @array.

Google for "perl deep copy"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,520
Latest member
KrisMacono

Latest Threads

Top