while (!eof(INPUT)) { $record = ; my @records = split(/\|/, $record); for (my $i=0; $idoQuery($report->{insertSQL}, $reportDate, @records); } #### sub doQuery { my $self = shift; my $sql = shift; my @values = @_; #Running the new query eval{ my $sth = $self->{"connection"}->prepare($sql); $sth->execute(@values); $sth->finish(); }; #If there are errors if ($@) { warn "Error!"; } return $self; } #### INSERT INTO QID.dbo.ReportT52 (report_date, insert_date, loan_num, loan_id, date_paid, payment_num, escrow, principal, interest, service_fee, net_interest, deposit_remit, balance, late_chg, other_trust, pi_constant, ann_ir, sf_rate, due_date) VALUES (?, GETDATE(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)