When you say, "I see nothing ... this only changes...", what precisely do you mean? Do you mean you the message goes away and nothing at all prints out? Or do you mean that when the message goes away, you get something printed out, just not the data you expected. Perhaps you are seeing one or more "<>" printed out?

What happens if you put a print statement in the second code sample, e.g.

my $line; my @fields; while ( $line = <FILE> ) { print STDERR "<$line>\n"; @fields = &quotewords( ',', 0, $line ) or ( warn "a problem on line $.:$_" ); # rest of code ... }

If the second loop also prints out nothing, then it would look like your file has no lines in it or your program is dying before it ever gets to the while loop. In rare circumstances, programs can die while doing "print STDERR", but this doesn't normally happen when you are only printing strings. Is this all of your code or do you have some extra material before the while loop?

The one thing that isn't likely is a problem with line endings. If there were a problem finding the line endings you would get one long line. If there was even one line, even an empty line, the print statement would at least print <>. That is why we made sure there was some non-whitespace in your print statement.

Are you absolutely sure that the file you are reading in is the file you think you are reading in? Your code is using relative paths. That means it will read the file in the current directory that has the name data.csv. Maybe this is an empty file with the same name as the real csv file? Have you tried running the program using a fully qualified path?

Best, beth


In reply to Re^5: line ending problem Text::CSV alternative Text::ParseWords? by ELISHEVA
in thread line ending problem Text::CSV alternative Text::ParseWords? by GertMT

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.