http://www.perlmonks.org?node_id=486695


in reply to Re^2: Textfile to csv with a small twist
in thread Textfile to csv with a small twist

The data provided is clearly *sample* data, and the code provided is of the same nature. The OP is asking about how to approach this problem. You're complaining that complete, robust solutions are not being provided, and that's where I think you are missing the point.



pbeckingham - typist, perishable vertebrate.
  • Comment on Re^3: Textfile to csv with a small twist

Replies are listed 'Best First'.
Re^4: Textfile to csv with a small twist
by jZed (Prior) on Aug 25, 2005 at 19:21 UTC
    Oh, sorry, I thought one of the points of answering "textfile to CSV" might be how to produce valid (in the sense of parseable) CSV.
Re^4: Textfile to csv with a small twist
by ChrisR (Hermit) on Aug 25, 2005 at 19:33 UTC
    I'm with you.

    The data is a simple sample. The code provided is also a simple sample. The OP did not ask for a production quality solution nor was one given.

    On the other hand, jZed provided no solution to the task at hand. I haven't yet needed to use a CSV parsing module but would love to see a good example provided here.

      The data is a simple sample.
      No it isn't, it has embedded newlines.
      jZed provided no solution to the task at hand
      That's because I was waiting for the OP to clarify what he/she really wanted. Now that the OP has done that, I've given the example, please see my code.
        ok. The fact that you were waiting for the clarification of the post which was quite vague makes sense. Perhaps I should have done that myself.

        I still see the sample data as "simple". Virtually every text file I parse has embedded new lines.

        I'll have to take a look at some of the text/csv parsing modules now. Your code made them look very useful and makes me think I have been working too hard at parsing in the past.