Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Re: csv to flat-file

by Bilbo (Pilgrim)
on Nov 28, 2002 at 09:35 UTC ( [id://216264]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: csv to flat-file
in thread csv to flat-file

OK. In the substitution replace the comma witha newline character: s/,/\n/g;

The split solution could become:

$, = "\n"; print split(',',$line);

($, = "\n"; sets the character used to separate entries when print is used to print an array, as returned by split)

As pointed out, all these solutions fail if any entries can contain a comma, in which case you should investigate the modules suggested elsewhere. I was assuming that since the format of your example was simple you would not have such complex data.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found