$sth = $dbh->prepare(...); foreach $po (@po) { for ($count=0; $count<=$i;$count++) { $sth->execute($old[$count],$po); # ... } }