in reply to Re: Using the same hashes as different object variables
in thread Using the same hashes as different object variables

Thanks for your reply
I think I do need a deep copy (my original hash also has arrays inside).
Can you give me a bit more info on how to use the Data:Dumper for a deep copy? I usually just use it for displaying a hash
  • Comment on Re^2: Using the same hashes as different object variables

Replies are listed 'Best First'.
Re^3: Using the same hashes as different object variables
by WizardOfUz (Friar) on Jan 20, 2010 at 13:03 UTC

    You could also use dclone() from Storable to make a deep copy of your data.

Re^3: Using the same hashes as different object variables
by trwww (Priest) on Jan 20, 2010 at 13:12 UTC
    my $hash = eval Data::Dumper->new([{foo => 1, bar => 2}])->Purity(1)->Dump;