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 = "ewords( ',', 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 |