in reply to Re^8: Why is my code assigning the last-retrieved value to all elements in my hash?
in thread Why is my code assigning the last-retrieved value to all elements in my hash?
Unless there's some reason for wanting '1', I'd put the actual book ID in the 'book_id' slot of that hash.
while (($book_id) = $sth->fetchrow_array()) { $booklist_1{$book_id}{'book_id'} = $book_id; }
Unless you have a book ID of '0', it will still be true in boolean tests, and it will be less confusing to future programmers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Why is my code assigning the last-retrieved value to all elements in my hash?
by punch_card_don (Curate) on Jul 10, 2008 at 12:30 UTC |