Some error messages would be nice, but one thing that springs to mind is that you don't declare any of your miriad of variables. strict will rightly yell at you for that. You also have lots of incorrectly closed quotes. It isn't very wise to post unobscured passwords on public forums either.
The following is an untested cleanup. Please do ask about anything you don't understand.
#!/usr/bin/perl -w use strict; use DBI; my @fields = qw( CLIENT RECORD CONTROL CUSIP FROMACCT F_IND TOACCT T_IND FP ORIGQTY DIV LTCG STCG SOCSEC BKRNO THIRDPARTYCD USERID EDATE ORIGAMT CLOSEDIND ADPSECNO BRNCH ACNT TYPE CHKDIGIT PDATE ACTLQTY ACTLAMT CERTIND REQST RDATE COMNTS TRNFTYPE FILLER1 ADR_L1 ADR_L2 ADR_L3 ADR_L4 ADR_L5 ADR_L6 FILLER_B CERTNO1 CERTSHRS1 CERTNO2 CERTSHRS2 CERTNO3 CERTSHRS3 CERTNO4 CERTSHRS4 CERTNO5 CERTSHRS5 CERTNO6 CERTSHRS6 CERTNO7 CERTSHRS7 CERTNO8 CERTSHRS8 CERTNO9 CERTSHRS9 CERTNO10 CERTSHRS10 FILLER_B ); my $dbh = DBI->connect( "dbi:ODBC:INSTDev", "sa", "password", { RaiseError => 1, PrintError => 1, AutoCommit => 1 } ) or die "Unable to connect: $DBI::errstr\n"; @ARGV = ("/tf_out.txt"); my $sth = do { my $cols = join(',', @fields); my $placeholders = join(',', ('?') x @fields); $dbh->prepare("INSERT INTO mf_forms ($cols) VALUE ($placeholders)" +; }; while(<>) { chomp; my %infields; @infields{+FIELDS} = split /\t/, $_, -1; $sth->execute(@infields{+FIELDS}); } $dbh->disconnect;
Makeshifts last the longest.
In reply to Re: Problem with code
by Aristotle
in thread Problem with code
by SamueD2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |