I'm not sure how many monks use perl on Win32, but I am
trying to convert data from an Access database to
something that can be used by MySQL on a Linux machine.
The problem I have is that I can't export the data
directly to a CSV because there are carriage returns,
and or line feeds in the data in one of the columns. So I
am using perl to read the data into memory from the
Access database (ODBC) and strip out all of the
offending characters that break the CSV output. Then I
plan to update that column in each record with the
changed data. I am, however, having a terrible time
getting it to work. I'm not sure if it's my perl code or
some other problem.
Here is what I am doing:
while( my @row = $sth->fetchrow_array() ) { my $descriz = $row[1]; # IDTitolo my $title_id = $row[0]; # Descriz $descriz =~ s/\^M//g; $descriz =~ s/\n//g; $descriz =~ s/^\s+//g; $descriz =~ s/\s+$//g; print $descriz, "\n"; # $dbh->do( "UPDATE Titoli SET Descriz = '$descriz' WHERE IDTitolo += '$title_id'" ); }
For some reason the information on the first line of the
data from the Descriz field gets completely truncated.
Here is what a sample record (the Descriz column) looks like.
RATED R In yet another bid to shed her girl-next-door image, Sandra
Bullock tackles a difficult role in this riveting
psychological thriller directed by Barbet Schroeder
(Single White Female), and under his guidance...<truncated
for brevity>.
Notice specifically the line breaks. This is what seems
to be giving me trouble. But, like I said, after I've
run it through my substitutions, The first line "RATED
R" is gone completely.
Any help would be appreciated.
Thanks.
-Matt
In reply to Perl with MS Access Weirdness by mlong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |