in reply to references changing a hash value
Try changing the line to
my $ranimals = { %animals };to see the behaviour that you expected. In this case, you are creating a _copy_ of the hash and getting a reference to the new copy. In your original code you are taking a reference to the original (and only!) hash so any changes you make through the reference effect the original array.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|