in reply to Why is my code assigning the last-retrieved value to all elements in my hash?
How are you initially populating %$booklist_1?
To test this, run this code:
You will get output like HASH(0x12345678). If you get the same line repeated, then all of your sub-hashes are in fact the same hash object.for $book_id (keys %$booklist_1) { print $booklist_1{$book_id}, "\n"; }
I could duplicate your output when I pre-initialized all of the %$booklist_1 hashes with the same hash.
|
|---|