Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^5: to csv file

by poj (Abbot)
on Jun 29, 2013 at 08:23 UTC ( [id://1041423]=note: print w/replies, xml ) Need Help??


in reply to Re^4: to csv file
in thread to csv file

I would change the other routine, but anyway, a simple solution would be double quote all the fields regardless.
#!perl use strict; open OUT,">test.csv" or die "$!"; while (<DATA>){ chomp; s/;;/","/g; print OUT '"'.$_.'"'."\n"; } close OUT; __DATA__ abd;;sasa;;trre,dsa;;sdas;;dsss abd;;sasa;;trre,dsa;;sdas;;dsss
poj

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2026-01-21 18:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (125 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.