PBP: 103 Separated Data

The Book suggests using split to take apart separated data with simple separators.

That’s not a bad suggestion, but it’s less common than you might think; real-world data is rarely that simple.  Be prepared to have to do more to handle the escaping of special characters.

(Tab separated data is way easier to deal with than CSV, as it’s usually less complex to escape.

One Response to “PBP: 103 Separated Data”

  1. Mark Dominus says:

    Randal Schwartz says “Use pattern matching when you know what you need to keep, and use `split` when you know what you have to throw away. I think that’s good advice.

    Sometimes you don’t know what you need to keep _or_ what you need to throw away, and that’s when things get sticky.

Leave a Reply