in reply to Help with CSV file parsing

Here's an easier way:
$var1 = 'a, a"s"d, 123'; @arr = split(/,/, $var1); print "@arr\n";
You'll want the dbh->quote() method: http://search.cpan.org/~timb/DBI-1.607/DBI.pm#quote

Cheers
Chris

Replies are listed 'Best First'.
Re^2: Help with CSV file parsing
by NOTSomebody (Initiate) on Aug 05, 2008 at 08:15 UTC
    Hi Chris, thanks for your reply. I understand your point but just that I am trying to read only the double quote. If the text contains other special characters, I will need to read also...

    Like
    $var1 = 'a, a"s,d,f,g", 123'

    Then the result I want will be:
    Insert into person_info VALUES (a, a"s,d,f,g", 123)

    Currently I can read every character without taking it out from the part of the text but if there is double quotes within the data, my generated SQL statements will be sort of screwed.