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>




Reply via email to