in reply to Re^6: 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?

So here's the truly bizarre part: Changing the hash populating routine to this
$sql = "SELECT book_id, title FROM booklist_table WHERE (expected_publ +cn_date >= '".$start_date."' AND expected_publcn_date <= '".$end_date +."')"; $sth = $dbh->prepare($sql) or die("Could not prepare!" . $dbh->errstr) +; $sth->execute() or die("Could not execute!" . $dbh->errstr); while (($book_id, $title) = $sth->fetchrow_array()) { $booklist_1{$book_id} = $title; } $sth->finish;
makes it all work perfectly.

Changing just one line of the above code to

$booklist_1{$book_id} = "ok";
makes it revert to the original incorrect behaviour.



Time flies like an arrow. Fruit flies like a banana.