Hello,
I am trying to read two CSV files into arrays and compare those values
for a data conversion project that I am on. While I am only addressing
1 CSV file for this example, I think that those with much more knowledge
than I on PERL will see immediately where I am going wrong. Currently,
I am receiving the error "Execution ERROR: Cannot open .\table: No such
file or directory at C:/PERL/site/lib/DBD/File.pm line 469.
Thank you for your time, experience and assistance.
use DBI;
$resultfile = "> IDEAMREP.TXT";
open(OUTPUTFILE, $resultfile);
my $dbh1=DBI->connect("DBI:CSV:IDEA.CSV"); # Call the DBI CSV
module to connect to the file IDEA.CSV
# The next statement will prepare to read the columns EMIDCM, RLCMCM,
etc. in the IDEA.CSV file and insert them into the table $sth1
my $sth1 = $dbh1->prepare( q{
INSERT INTO table (EMIDCM, RLCMCM, RLCDCM, RLCYCM, LIENCM, UOFACM,
CTIDCM, CTCKCM) VALUES (?, ?, ?, ?, ?, ?, ? ,? ,?)
});
while ($sth1) {
chop;
my ($EMIDCM, $RLCMCM, $RLCDCM, $RLCYCM, $LIENCM, $UOFACM, $CTIDCM,
$CTCKCM) = split /,/;
$sth1->execute($EMIDCM, $RLCMCM, $RLCDCM, $RLCYCM, $LIENCM,
$UOFACM, $CTIDCM, $CTCKCM) || die "Couldn't execute the sth1 statement";
# Now print the arrays $EMIDCM, $RLCMCM, etc. to the OUTPUTFILE
print OUTPUTFILE;
print OUTPUTFILE "$EMIDCM, $RLCMCM, $RLCDCM, $RLCYCM, $LIENCM,
$UOFACM, $CTIDCM, $CTCKCM\n";
}
close FH1;
$dbh1->commit;
$dbh1->disconnect;