for (1..$#{$columns}) { $sth = $dbh->prepare("UPDATE yeast1 set $tables[$_] = temp/$tables[$_-1] where yeast1.orf = temp.orf; INSERT INTO profile_index VALUES ('$tables[$_-1]', '$columns->[$_]')"); $sth->execute; $sth = $dbh->prepare("UPDATE yeast1 set $tables[$_-1] = 999 where $tables[$_-1] IS NULL"); $sth->execute; }