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


in reply to Logic Help - Output to csv

Desired output

"sku","File 1", "File 2", "File 6", "File 7" "00123","www.site.com/path/to/file/file.pdf","www.site.com/path/to/fil +e/file.pdf",, "00124","www.site.com/path/to/file/file.pdf",,"www.site.com/path/to/fi +le/file.pdf", "00125",,"www.site.com/path/to/file/file.pdf",,"www.site.com/path/to/f +ile/file.pdf"

Maybe I am just nitpicking, but I sincerely hope you do not want the spaces after the separator (", ") in the header line.

If you do, why not after the first separator? The required output as you show is extremely hard to generate and results in incorrect CSV data.

For all other advice, read haukex' answers.

For more speed, use Text::CSV_XS instead of Text::CSV.


Enjoy, Have FUN! H.Merijn