you can use the Unix command `od -c <filename>`, which will give you an
octal dump in character mode of the file. This will tell you what characters
are where in the file. 

-----Original Message-----
From: Jason Purdy [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 2:25 PM
To: [EMAIL PROTECTED]
Subject: Text::CSV problem



I have this CSV file given to me to grab fields and compare/update against a

db following some rules.  I'm having problems parsing the CSV file, though, 
b/c of some certain characters.

I don't know what the characters are (newlines, \r's, etc [or some 
combination of the above]) and I tried s//'ing them out to no avail.  In 
StarOffice, the characters appear as a "box".  When Text::CSV (and I
upgraded 
to Text::CSV_XS) spits out the error, it appears that there are newlines in 
there:

There was an error parsing oldfile.csv: 16NNNN,"John","Smith",,"OTHER
 
 
                                                                    
","McDonald's CORE Lab","123 Main St.",...

Thanks in advance for any of your help!  Is there any way to identify what 
those characters are?

Jason

Here's some of my code:

open ( FILE, shift );
@lines = <FILE>;
close ( FILE );

$csv = Text::CSV_XS->new();

foreach ( @lines ) {
        chomp $_;
        s/[\r\n]//g;
        if ( $csv->parse( $_ ) ) {
                ...
        } else {
                print "There was an error..." . $csv->error_input . "\n";
        }
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to