[Chicago-talk] Removing Characters

Andy Lester andy at petdance.com
Mon Oct 22 08:24:27 PDT 2007


On Mon, Oct 22, 2007 at 07:52:33AM -0700, tiger peng (tigerpeng2001 at yahoo.com) wrote:
> There must be better way for removing the double quote in a CSV file optionally quoted by double quote.
> What I did as below is ugly and not reliable. Could anyone provide one beautify line?
> 
>   $delimiter=chr(0227);
>   s/^"/$delimiter/g;
>   s/,"/,$delimiter/g;
>   s/"$/$delimiter/g;
>   s/",/$delimiter,/g;
>   s/"//g;
>   s/$delimiter/"/g;

Why are you trying to remove the double quotes?  Is the format wrong?

I would probably read in your CSV file with Text::CSV_XS and re-output
it with different parameters.

-- 
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance


More information about the Chicago-talk mailing list