RE: copying complex data structures

2003-12-12 Thread West, William M
use Storable;
$arrayref_one = dclone( $arrayref_two );



aha



thanks :)

it's those details that make a program so much easier to make..

i noticed another poster asking about reference notations- i think that this

and Object Oriented programming have given me the most headaches on a 
conceptual level.  

while i've gotten a handle on references (i hope) tha OO stuff still gets to
me *laugh*


again thanks,
willy

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: copying complex data structures

2003-12-11 Thread James Edward Gray II
On Dec 11, 2003, at 9:37 AM, West, William M wrote:



the following will not work:

$arrayref_one = $arrayreftwo; #it's just making a new name for the same
#reference.
the following works fine:

foreach my $a (0..$what){
foreach my $b (0..$why){
$arrayref_one-[$a]-[$b] = $arrayref_two-[$a]-[$b];
}
}
it would be nice to have something to copy complex data structures that
isn't going to be a code maintenance headache-  the above is dependent
on the data structure being a 2 dimensional array of particular size.
i don't want that restriction.
any help would be apreciated :)
From the Perl Cookbook (2nd Edition), recipe 11.12:

use Storable;
$arrayref_one = dclone( $arrayref_two );
James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: copying complex data structures

2003-12-11 Thread NYIMI Jose (BMB)
Try clone method of Storable module from CPAN.
There is also Clone module out there.

HTH,

José.

-Original Message-
From: West, William M [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 11, 2003 4:37 PM
To: [EMAIL PROTECTED]
Subject: copying complex data structures




the following will not work:

$arrayref_one = $arrayreftwo; #it's just making a new name for the same
#reference.


the following works fine:

foreach my $a (0..$what){
foreach my $b (0..$why){
$arrayref_one-[$a]-[$b] = $arrayref_two-[$a]-[$b];

}
}

it would be nice to have something to copy complex data structures that isn't going to 
be a code maintenance headache-  the above is dependent on the data structure being a 
2 dimensional array of particular size. i don't want that restriction.

any help would be apreciated :)

thanks,
willy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ 
http://learn.perl.org/first-response




 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response