http://qs321.pair.com?node_id=1208161


in reply to Re^2: Modifying an existing Perl script to ask for input and output filenames and also remove double quotes for outfile file
in thread Modifying an existing Perl script to ask for input and output filenames and also remove double quotes for outfile file

I agree much with you Grandfather, however he stated in his post-
When I run the script on my input.csv file the output.csv file which is created by the script has double quotes in two of the data columns, i.e. the Timestamp field "2018-01-23 00:00" and the ProdDescription field "Acme Widget Large 20 inch" These double quotes need to be removed to comply with the required data format of the final csv file.
So I don't know if he sends the result somewhere, they will be able to parse a proper CSV file.

Needed additions/changes to the script to make it proper would be:

Add use Text::CSV; in the header with the other use statements.

Create a new csv object, my $csv = Text::CSV_XS->new({binary => 1, eol => $/}); before the while loop.

Instead of the print statement, use $csv->print($out, [ @tmp{@cols} ]);.