I wouldn't recommend Text::CSV either but mostly because it never worked well for me. Text::CSV_XS *is* maintained and by our very own jZed who has a bunch of other modules as well. Text::xSV is by tilly. I never bothered with it because I already had something spiffy.

Of course, updates per year aren't important either. If the author of Text::CSV had handled the parsing difficulties nince years ago, it's be perfectly fine to have no updates for all that time. You only update something when it needs changes.

use Text::CSV_XS; # which is maintained by jZed and well loved by all # Read it as a handle w/ binary if newlines might be embedded in your +data my $csv = Text::CSV_XS->new( binary => 1 ); open my $fh, \ $your_string; while ( my $columns = $csv->getline( $fh ) ) { ... } # Or just read it like a string if you never have newlines inside a va +lue. while ( $str =~ /(.+)/g ) { my $line = $1; my $columns = $csv->parse( $line ); }

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊


In reply to Re: Treating a scalar as an "input file" by diotalevi
in thread Treating a scalar as an "input file" by graff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.