Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Don't rule this a bug in DBD::CSV until you do more investigation. It is quite possible that there is a single mis-matched " in the file, and DBD::CSV is interpreting that oddly, and you lose lots of lines. Try taking the CSV file and cutting it in halves, see if each half is handled normally, and then do a binary search to find the data confusing DBD::CSV. After you find that, then decide whether it is doing the wrong thing, and if it is, then you can now send a useful bug report.

If there is a data problem, running through the file with Text::xSV might spot it very quickly since it doesn't try to DWIM around errors and gives fairly detailed error reporting.

As for your code, you do not handle commas, returns or double-quotes properly in a quoted field. Doing it right is surprisingly tricky. I would suggest using a module. Here are some options. Text::CSV is simple to use, but doesn't handle embedded returns properly. Text::CSV_XS is much faster and does handle embedded returns, but it has to be compiled. Text::xSV also handles embedded returns, but is much slower. Unfortunately no two of these have compatible APIs.

In reply to Re: DBD::CSV limitation versus aging/unmaintained modules by tilly
in thread DBD::CSV limitation versus aging/unmaintained modules by Eyck

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2022-06-26 18:23 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (86 votes). Check out past polls.