Jason Frisvold wrote at Fri, 07 Jun 2002 17:42:52 +0200:
> Ugh...
>
> I figured out what it's choking on by using Text::CSV instead of DBD::CSV ... Some
>of the entries
> look something like this :
>
> "06/06/02","22:16:23","Some stuff here","LDAP JUNK DN="\\HERE\123" AT="7" US=""
> SI="12345"",,,,"More junk",,,
>
> The problem, I believe, is that LDAP JUNK.... I think those quotes inside the
>quotes area are
> causing Text::CSV to fail that line... The lines in the file without the LDAP
>garbage are working
> fine...
>
Year, Text::CSV expects even stuff without quotes or with.
With quotes, inner quotation marks must be marked with "".
Like "LDAP ... "" ..." or a little bit crazier:
"""Hello World!""" to save the quoted string "Hello World!"
If you could be sure that no one of your data contains a comma,
you could simply use a split and remove the quotes at both sides.
If I look right to your data, then the format is:
Every non empty dataset is quoted.
Something like " "Hi," he said " can't happen.
So you also could use this regex:
my @fields = $line =~
m/ (?: \" (.*?) \" )? , /gx;
Best Wishes,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]