I see a number of problems in the posted code. But you are able to get some kind of printout until the end-of-line. I suspect a problem there. You should NOT use bin mode! This can be big trouble! A .CSV file is ASCII, not binary.

I suspect that you have kind of inter-change problem between Windows and Unix. On Windows end-of-line is "\r\n", on Unix this is just "\n".

Normally Perl will do "the right thing" for this translation, eg, it doesn't matter all all. Using Bin mode can defeat this "smarts". That is a different thing than how you move files between systems, but most of these things are pretty smart too and I use a number of them. For an ASCII file you shouldn't use bin mode for the transfer.

post just a couple lines of your file it you can. It is hard for me to understand what you are trying to do from what I've seen so far.

Edit: Looking more at the Text::CSV_XS module and it appears that I am wrong above. This module does have some trouble with \n. I have used this before but only in conjunction with DBI and SQL modules that evidently don't have this problem. Anyway post a couple lines of the CSV db (don't use "real" data that would cause problems), just an example.


In reply to Re^3: Text::CSV_XS and "binary" mode by Marshall
in thread Text::CSV_XS and "binary" mode by bittis

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.