There are two ways to take a reference to a hash.
If you use the \%hash syntax then you are taking a reference to the _original_ hash. Any updates that you make through that reference will obviously update the original hash (as, actually, there is only ever one hash).
If you use the { %hash } syntax then you are creating a new anonymous hash which is a _copy_ of your original hash and getting a reference to this new hash. Any updates you make through this reference will update the copy of the hash and not the original hash.
I recommend reading "perldoc perlreftut" and "perldoc perlref" to clarify these concepts.
--
< http://www.dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
|