in reply to Match a comma between two words
(It could also be done the other way around, first splitting on commas and then removing quote marks.) But now, either way, think about what will happen when your input line is:$line =~ s/"//g; my @fields = split /,/, $line;
Both ways, it will break with an unwanted extra field, and you'll be out of luck. We do use quite commonly split to process simple CSV files (although our separator is usually a semi-colon rather than a colon), but only (well almost only) on CSV files that we have created beforehand and in which we fully master the content and we know we are not gonna have a bad surprise."New York, NY","Entries","Entry Time","Visit Length","Browser"
On files coming from an outside organization on which you have no control, don't do it. In your case, the simple fact that there are both separators and delimiters is a sign that there is a clear danger that your process is probably going to break on the first special case coming up. The Text::CSV module is really a much more robust alternative in any case where you don't control everything yourself.
|
|---|