PERL_fresher has asked for the wisdom of the Perl Monks concerning the following question:
Hello Fellow monks I need some help with the update of one of the CSV files that Im trying to do. Basically one of the file has set of records which I dont want to update for example
Above is the file format. what i need to do is to start updating this table from row 3 where the actual data isSouce Data X~Y~Z 1~2~3 col1~col2~col3~col4~col5 A~B~C~D~E
my $dbh = DBI->connect("dbi:CSV:",undef,undef,{ f_dir => $_ENV::TempFilesDIR, csv_sep_char => "~", csv_quote_space => 0}) or die $DBI::errst +r; $dbh->{'csv_tables'}->{'cimp_money'} = { 'file' => 'Aviva_cimp_ +money_positive.txt', col_names => [qw(rcrd_typ +e seq_no emp_no forename surname initial ni_no ttl gender dob emp_cnt +rbtn emplyr_ctr tax_peri +od tax_yr exch_amt)] $dbh->do('UPDATE cimp_money SET forename=?,surname=? WHERE emp_no=?',u +ndef,$wrk_forename,$wrk_surname,$wrk_emp_no) or die $DBI::errstr;
Basically updates are happening correctly but the issue Im facing is since the header records i.e. first 2 lines are just 3 columns and details records has 4 columns its assuming that even in first 2 rows also it has a header and its updating ~ to row 1 and 2 which is what I want to remove now
Output Data X~Y~Z~~ 1~2~3~~ col1~col2~col3~col4~col5 A~B~C~D~E
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::CSV Update
by CountZero (Bishop) on May 28, 2015 at 15:51 UTC | |
|
Re: DBD::CSV Update
by Anonymous Monk on May 28, 2015 at 11:18 UTC | |
by Tux (Canon) on May 28, 2015 at 14:49 UTC | |
by soonix (Chancellor) on Jun 01, 2015 at 10:37 UTC | |
by Tux (Canon) on Jun 01, 2015 at 13:19 UTC | |
by soonix (Chancellor) on Jun 02, 2015 at 09:38 UTC | |
|
Re: DBD::CSV Update
by Anonymous Monk on May 28, 2015 at 09:50 UTC | |
by Anonymous Monk on May 28, 2015 at 09:55 UTC | |
by PERL_fresher (Novice) on May 28, 2015 at 10:04 UTC | |
by Anonymous Monk on May 28, 2015 at 10:47 UTC |