my $sql_select = "select * from $tableName"; my $sth = $db->do($str_select); $sql_delete = "delete from $tableName where LiftChr=? and LiftPos=?"; my $sth1 = $db->prepare($sql_delete); while ($snp = $sth->fetchrow_hashref) { $sth1->execute($sql_delete, undef, $snp->{'LiftChr'}, $snp->{'LiftPos'}); }