in reply to finding commas within commas
All that can be said for this solution is that it works on your test string. Beyond that?
my $str = q["2","T,E,S,T,B","Lazowsky","Mike's","Teststring"]; $str =~ s< \s* ( \"[^\"]+ \" \s* ) (,|$) > < (local $a = $1) =~ tr/,//d; $a . $2 ; >gex; #!" print $str; __END__ #Output C:\test>229505 "2","TESTB","Lazowsky","Mike's","Teststring" C:\test>
Update: Corrected error that LAI++ spotted.
That said, Text::CSV is almost certainly better.
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: finding commas within commas
by LAI (Hermit) on Jan 24, 2003 at 14:15 UTC | |
|
Re: Re: finding commas within commas
by Anonymous Monk on Jan 24, 2003 at 01:56 UTC | |
by BrowserUk (Patriarch) on Jan 24, 2003 at 06:02 UTC |