I suspect you can make the problem go away by fixing up your SQL. You're trying to retrieve records for an arbitrary list of ids, or something similar, right? If your database supports it, use IN (list) instead, and you can avoid the loop entirely. eg:
my @entries; my $idlist = join(',',map("'$_'",@keys)); my $sth = $dbh->prepare("SELECT * FROM mumble WHERE id IN($idlist)"); $sth->execute(); while (my $aref = $sth->fetchrow_arrayref()) { push(@entries,$aref); }
It's nice to learn why my 'push while fetch' constructions never worked, though.
update: if your @keys might contain anything more complicated than simple strings or numbers, it's better to use:
my $idlist = join(',',map($dbh->quote($_),@keys));I think.
In reply to Re: Multiple references pointing to the same memory location
by thpfft
in thread Multiple references pointing to the same memory location
by ezekiel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |