On Wed, 19 Nov 2008 17:36:55 -0800, Jim Gibson <> wrote:
>In article <>,
><> wrote:
>
>> Hi, I have a need for a Class copy constructor and wonder
>> if anybody has implemented this.
>
>See the dclone function of the Storable module or the article
><http://www.stonehenge.com/merlyn/UnixReview/col30.html>
I knew about deep copy. I read the whole article. I didn't look
at the dclone function yet (as they recommend on that page).
I found it interresting, the recursive sub to find array's that
need to be dup'd. And I'm even better appretiative of Dumper now.
I had some anonymous sub ref's hanging around, wondered about them.
One thing is that if you 'empty' an array, reference or not, by
declaring it with () again, does it create another reference to it
(anonymous or if a reference is taken of it before its cleared)?
I haven't looked at it specifically yet in terms of deep copy but
something like this I will have to resolve:
$href = {};
$href->{aray} = ['1','2'];
or
@tt = ('1','2');
$href->{aray} = \@tt;
@{$href->{aray}} = ();
I know $href->{aray} is a reference,
but if a copy of $href was made,
before it was cleared with = (), is the data
still intact in the copy, or would I have to
do an explicit $newhref->{aray} = [@{$href->{aray}}] ?
Convuluted. Thanks!
sln
|