in reply to Re^2: how to modify a field in a CSV file
in thread how to modify a field in a CSV file

I'm trying to retain the double quotes and the comma delimiters that were part of the input file. I'd like to think that I can do this with text::csv_xs

Sure, see combine().

my $csv = Text::CSV->new ( { quote_space => 0 } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); my @columns = ("What, a nice day", "This is a fence", "Here is an,and +day"); print $csv->string() if $csv->combine(@columns);

generates the following line:

"What, a nice day",This is a fence,"Here is an,and day"

Replies are listed 'Best First'.
Re^4: how to modify a field in a CSV file
by beerman (Novice) on Sep 02, 2011 at 20:25 UTC
    That did it! Thank you so much for cluing me into to the combine function. You are great and the next beer I drink is in your honor!

      Or use print when setting eol attribute

      my $csv = Text::CSV->new ({ quote_space => 0, eol => "\n", auto_diag = +> 1 }); my @columns = ("What, a nice day", "This is a fence", "Here is an,and +day"); $csv->print ($fh, \@columns);

      Enjoy, Have FUN! H.Merijn