Kiko has asked for the wisdom of the Perl Monks concerning the following question:
Hey,
I got the script down to this:
And it still doesn't work. I don't know what's wrong because i'm not getting any errors. Can anyone help?#!/perl/bin/perl use Win32::ODBC; use win32; use CGI qw(:standard); $data="data.csv"; my (@statement); # array of sql statements my $db=new Win32::ODBC("DSN=test;UID=;PWD="); ### report connection status if (!$db) { die "\nunable to connect to database! $!"; } ### Open File for Reading open(FR, "< $data") || die "cannot open $data for reading: $!"; while(<FR>) { my ($d1, $d2, $d3, $d4, $d5, $d6, $d7, $d8) = split /\,/; ($d1) = "$d1\@test\.com"; ($d2) =~ s/LBAM\///; ($d2) =~ s/LBAS\///; ($d2) =~ s/LBEU\///; ### Write to Database push @statement, " INSERT INTO NEW (mail_alias, NT_login, firstname, middle_init, surname, profit_loss, dept, org_unit_name) VALUES ('$d1', '$d2', '$d3', '$d4', '$d5', '$d6', '$d7', '$d8') "; } ### Close the files close(FR) || die "cant close $data: $!"; ### Close the database $db->Close();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Reading from a file
by chromatic (Archbishop) on Apr 03, 2000 at 23:23 UTC | |
Re: Reading from a file
by Anonymous Monk on Apr 04, 2000 at 00:30 UTC | |
by plaid (Chaplain) on Apr 04, 2000 at 00:40 UTC |
Back to
Seekers of Perl Wisdom