in reply to Regex to do a smart split()

There's plenty of CSV-handling code written already, which deal with all of these issues (and more). CPAN is a library of freely available Perl modules which have been tested and documented for easy use in your projects. Browse search.cpan.org, for example, Text::CSV.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Re: Regex to do a smart split()
by hardburn (Abbot) on Jan 30, 2004 at 15:49 UTC

    Do note that Text::CSV has been sitting at a 0.01 release since 1997 and should be considered deprecated. Text::CSV_XS is a much better choice. It's faster and has only been sitting since 2001 (a little better, anyway).

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

      No, its the other way around. Text::CSV works for more data than Text::CSV_XS. I never looked into what the issue was but the XS version is clearly inferior to the plain-perl version because it works when the other version flat-out fails.

        According to replies to Reading escaped data from a CSV, Text::CSV doesn't handle embedded newlines (Text::CSV_XS will as long as you use binary mode). Though after looking though those replies, Text::xSV looks even better.

        ----
        I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
        -- Schemer

        : () { :|:& };:

        Note: All code is untested, unless otherwise stated

      and should be considered deprecated.
      Because it's old?
Re: Re: Regex to do a smart split()
by Anonymous Monk on Jan 30, 2004 at 15:54 UTC
    Thanks for super-fast response. I'd completely forgotten about the existance of CPAN...
      I'd completely forgotten about the existance of CPAN... (sic)

      Yer not from around here, are ye? :p

      --
      Allolex