in reply to Why is my code assigning the last-retrieved value to all elements in my hash?
Just a suggestion - use Data::Dumper for printing out the entire hash, rather than looping through.
[ http://search.cpan.org/~ilyam/Data-Dumper-2.121/Dumper.pm [
So maybe I'm missing something - where are you incrementing $book_id?