in reply to Search/Replace within fields of CSV
use Modern::Perl; use DBI; my $dbh = DBI->connect( "dbi:CSV:", undef, undef, { f_ext => '.csv', f_dir => 'D:/Perl/scripts', RaiseError => 1, } ) or die "Cannot connect: $DBI::errstr"; $dbh->do(q/UPDATE test SET First = 'CONDENSED' WHERE test.First = 'C'/ +); $dbh->do(q/UPDATE test SET First = 'FINAL' WHERE test.First = 'F'/); $dbh->do(q/UPDATE test SET Fifth = 'Ohio' WHERE test.Fifth = '0H'/); $dbh->do(q/UPDATE test SET Fifth = 'Oregon' WHERE test.Fifth = '0R'/);
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |