in reply to Re: printing to a file
in thread printing to a file

Or since it's CSV data use Text::CSV_XS and let it bother with quoting and what not.