Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Logic Help - Output to csv

by Tux (Canon)
on Jun 08, 2020 at 06:53 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-06-10 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (36 votes). Check out past polls.

    Notices?