in reply to Parse a pipe-delimited list

I prefer to use DBD::CSV and set "csv_sep_char=\|;"


Evan Carroll
www.EvanCarroll.com

Replies are listed 'Best First'.
Re^2: Parse a pipe-delimited list
by grep (Monsignor) on Sep 20, 2006 at 17:14 UTC
    Unless you can't compile XS, I would recommend Text::CSV_XS or Text::CSV::Simple (which uses Text::CSV_XS) you may not need the performance now but, I find I use it enough that you'll run into those situations.

    Also Text::xSV looks good

    These modules get around the problems with using split. The big problem being, escaped seperators in the data. Unless you are dead certain that the data has been cleaned of |'s avoid split.

    Even if you can get by with split and don't really need Text::CSV_XS now you'll be better off learning the module. This type of thing comes up a lot and split can really bite you.



    grep
    Mynd you, mønk bites Kan be pretti nasti...