-----Original Message----- From: RICHARD FERNANDEZ [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 2:37 PM To: beginners@perl.org Subject: RE: parsing a CSV file with more fields than column names
>> Are you SURE that there might be commas in the other fields? >> I would hope that whoever made this file you're parsing would >> have thought of this if they ever intended to later use the data. > Good point. But I have no way of verifying that. > > These CSV files are provided to me by an outside source. I don't know if > I'll be able to pin anyone down on the "comma issue". And I've already > gotten bad answers to other technical questions... > > <snip> Your next best bet, then, might be to check each field and see if they follow a close enough pattern that you can create a regex that will help "validate" that field. Even if you can only narrow down a few fields, you will be able to tell if the commas are off. That doesn't automatically fix the problem, but it does let you know if your input data is dirty and can let you know where to check for problems. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>