DBD::CSV can see past the line breaks, and will read the Memo field as you intended. I think your best bet is to use the DBI all the way... Something like this:
#! /usr/bin/perl
# Untested, but ought to be close, if not right on.
# Assumes CSV file is called 'people', in /home/me/db.
use strict ;
use warnings ;
$|++ ;
use DBI ;
my $dbh = DBI->connect( "DBI:CSV:f_dir=/home/me/db;csv_eol=\n",
{ RaiseError => 1 } ) ;
# Get the data out of the CSV file.
my $sth = $dbh->prepare( 'SELECT * FROM people' ) ;
$sth->execute ;
my $data = $sth->fetchall_arrayref( {} ) ;
$dbh->disconnect ;
$dbh = DBI->connect( "DBI:mysql:my_db", 'username', 'password',
{ RaiseError => 1 } ) ;
# Dump into the MySQL table.
$sth = $dbh->prepare( <<'END_OF_SQL' ) ;
INSERT INTO my_people
( ID, Name, Memo )
VALUES
( ?, ?, ? )
END_OF_SQL
foreach ( @$data )
{
$sth->execute( $_->{'ID'}, $_->{'Name'}, $_->{'Memo'} ) ;
}
__END__
_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche
|