Hey, I got the script down to this:
#!/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();
And it still doesn't work. I don't know what's wrong because i'm not getting any errors. Can anyone help?

In reply to Reading from a file, writing to a database by Kiko

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.