Copying a hash-of-hashes
From: Luke Bakken (Luke.Bakken_at_getronics.com)
Date: 12/30/04
- Previous message: Dave Gray: "Re: Copying a hash-of-hashes"
- Next in thread: Alfred Vahau: "Re: Copying a hash-of-hashes"
- Reply: Alfred Vahau: "Re: Copying a hash-of-hashes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Dec 2004 10:31:04 -0800 To: <beginners@perl.org>
> Hello List,
> To explain the problem I am having, I wrote a simple snipet
> that doesn't do
> anything meaningful other than illustrating the behaviour I
> want to avoid:
>
> my %hoh = (
> 1 => {
> a => 5, b => 5
> },
>
> 2 => 5
> );
>
>
> my @res = &RANDOMSUB; #call a random subroutine
>
> print "$hoh{1}{a} $hoh{2} \n";
>
>
> sub RANDOMSUB {
> my %hohcopy = %hoh;
>
> $hohcopy{1}{a} = 2;
> $hohcopy{2} = 2;
> }
Search for "clone" on search.cpan.org
- Previous message: Dave Gray: "Re: Copying a hash-of-hashes"
- Next in thread: Alfred Vahau: "Re: Copying a hash-of-hashes"
- Reply: Alfred Vahau: "Re: Copying a hash-of-hashes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]