in reply to Assigning Hash To Another Hash References Same Hash

To explain what's going on here...

Your assignment %tmpHash = %h does copy by value as you assume. The problem is that the values in your hash are actually references to other hashes. Therefore when you alter something at second level of the data structure (as your example does) it's actually the same "second-level" hash that gets updated.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you don't talk about Perl club."

  • Comment on Re: Assigning Hash To Another Hash References Same Hash