I have a test.csv file with multi line in one field like following:
Name, message
"Gus", "See you"
"Amy", "take to you later,
Thank you.
call me"
"Mark", "Try it again
Okay"
Here is my code:
It read first record right, but not the second and third ones. Can someone give me some advice how to read this csv file?
Thanks a lot!!!!
Name, message
"Gus", "See you"
"Amy", "take to you later,
Thank you.
call me"
"Mark", "Try it again
Okay"
Here is my code:
Code:
open(CSV, "test.csv") or die "Cannot open test.csv for read\n";
my $string = <CSV>;
while (<CSV>)
{
chomp;
my @list = split (",");
foreach @list;
print "$list[0] <$list[1]>\n";
}
Thanks a lot!!!!
Comment