Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: to csv file

by Anonymous Monk
on Jun 29, 2013 at 07:56 UTC ( #1041416=note: print w/replies, xml ) Need Help??


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

hey the thing is i need the output as csv , because it is an input to other sub routine

Replies are listed 'Best First'.
Re^5: to csv file
by poj (Prior) on Jun 29, 2013 at 08:23 UTC
    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
Node Status?
node history
Node Type: note [id://1041416]
help
Chatterbox?
Corion joins another telephone call :-/
[Discipulus]: also The Life and Opinions of the Tomcat Murr
[Discipulus]: I dunno if i can read Dumas in french.. must try some chapter to see
erix . o O( "what fools the french are, Jeeves" )
[choroba]: Also some Достое́вс кий
[Discipulus]: mmh windows understand something like: cd c:\\\\path\\\\to weird..

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2017-05-24 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?