Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Logic Help - Output to csv

by Tux (Canon)
on Jun 08, 2020 at 06:53 UTC ( [id://11117800]=note: print w/replies, xml ) Need Help??


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

Replies are listed 'Best First'.
Re^2: Logic Help - Output to csv
by Eily (Monsignor) on Jun 08, 2020 at 12:18 UTC

    Text::CSV already calls Text::CSV_XS when available, so in most case it won't have any impact on speed, and in some other cases it will stop working altogether.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11117800]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found