in reply to An Array Without and Index

I'm not sure what is going on here.
Prepare the statement before starting the loop (do it only once)
Execute the statement, filling in the placeholder (?) within the loop
my $addr_lookup = 'SELECT u2addr.id FROM u2addr WHERE u2addr.addr = ?'; my $stm = $dbh->prepare($addr_lookup); foreach my $addr (@addr) { $stm->execute($addr); my @results=(); while (my @row = $stm->fetchrow_array) { push (@results, [@row]); #push array ref to @row #using new memory and copy of @row #could also just fetchrow_arrayref } ## do something with @results here... ## perhaps: "print Dumper \@results;" ## to see what you have in @results? }