Here is the code snippet from the sqlite database application I'm working on:
my $query = "select * from pins"; my $sth = $dbh->prepare($query) or die "Couldn't prep: $DBI::errstr"; $sth->execute or die "Exec problem: $DBI::errstr"; my $result = $sth->fetchall_arrayref(); my $names = $sth->{NAME} or die "Name failed: $DBI::errstr"; foreach my $row (@$res) {
The query works just fine, and in fact it returns the correct results. However, for some reason this line,
my $names = $sth->{NAME} or die "Name failed: $DBI::errstr";
Fails. {NAME} never returns an array that I would expect. If I take the die die clause, it works fine (throwing the expected βusing uninitialized valuesβ warning everywhere I use the $ names, of course).
Is there any obvious reason why I miss that {NAME} is not working, given that the request worked fine?
Thanks!
source share