http://www.perlmonks.org?node_id=501734

benrwebb has asked for the wisdom of the Perl Monks concerning the following question:

Here is my situation: I'm inside a method. I access a local variable (a hash ref), munge the hash and then return my munged data. The problem comes in that I seem to be munging my member variable as well. I need to work with a local copy so that the member variable is uncorrupted. Here is my current (broken) code:
my $aref = $self->{atlas}; my %atlas = %$aref; ... munging ...
What do I need to do to make manipulating %atlas non-destructive to $self->{atlas} ?

Thanks!