RE: Deep Copy

2003-07-30 Thread Marcos . Rebelo
see: use strict; use Data::Dumper; sub simpleClone($){ my ($toClone) = @_; my $Return; if (ref($toClone) eq 'HASH'){ $Return = {}; while (my ($key, $value) = each(%$toClone)){ $Return-{$key} = simpleClone($value); } } elsif (ref($toClone) eq

RE: Deep Copy

2003-07-30 Thread Marcos . Rebelo
, 2003 8:33 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Deep Copy see: use strict; use Data::Dumper; sub simpleClone($){ my ($toClone) = @_; my $Return; if (ref($toClone) eq 'HASH'){ $Return = {}; while (my ($key, $value) = each(%$toClone

Re: Deep Copy

2003-07-30 Thread Steve Grazzini
On Wed, Jul 30, 2003 at 08:43:48AM +0200, [EMAIL PROTECTED] wrote: Less code: sub simpleClone($){ Even less[0] use Storable qw(dclone); my $dolly = dclone($dolly); Storable is also fast and comes standard with 5.8. -- Steve [0] actually quite a bit more, but you don't

RE: Deep Copy

2003-07-30 Thread NYIMI Jose (BMB)
There is also a good article on the topic at http://www.stonehenge.com/merlyn/UnixReview/col30.html snip Now, this simple deep_copy routine will break if there are recursive data pointers (references that point to already seen data higher in the tree). For that, you might look at the dclone

RE: Deep Copy

2003-07-30 Thread bseel
Thanks for all of your help! I got it with the module, but I am going to play with some of that code now :). Thanks for all of your help. Brian Seel High School Intern Micron Technology [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

RE: Deep Copy

2003-07-29 Thread Hanson, Rob
Use Clone. http://search.cpan.org/author/RDF/Clone-0.13/Clone.pm use Clone qw(clone); my $newhash = clone($hashref); Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 5:29 PM To: [EMAIL PROTECTED] Subject: Deep Copy I am trying to

Re: Deep Copy

2003-07-29 Thread Rob Dixon
[EMAIL PROTECTED] wrote: I am trying to make a deep copy in a complex data structure. I have a hash that has all of its values as anonymous arrays. I need to copy the entire hash as a completely separate hash so that I can manipulate the data in the copy without affecting the original data.

RE: Deep copy

2002-08-09 Thread NYIMI Jose (BMB)
What you mean by deep copy ? Be more clear :-) José. -Original Message- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Friday, August 09, 2002 3:40 PM To: Beginners (E-mail) Subject: Deep copy Hey anyone have the link handy that explained deep copying and had the simplest

RE: Deep copy

2002-08-09 Thread Nikola Janceski
; Beginners (E-mail) Subject: RE: Deep copy Deep copy. I have a data structure (hashes of hashes) I want to make a real/deep copy of the values to store elsewhere. So when I change the values of one, the references don't point to the same values as the original data structure. hence deep copy