in addition to use warnings;. Once you do that, though, you'll need the lines:use strict;
I noticed a couple minor things about your 'open'. You probably shouldn't put IN in parens and you'll be a little safer if you use the 3 parameter version. The other advice, to use 'or die' is necessary, here:my $read; my @lst;
After you get this working, though, you'll stumble across a subtle bug in your 'while' loop. By putting $read in parens, you've made it an element of a list. <IN> in a list context will slurp-up the whole file and, since there's only one element of the list ($read), only the first line gets assigned to something -- the rest of the file gets discarded. This way, the 'while' is guaranteed to run exactly once. Instead, you probably want:open (IN, "<", "dev.csv") or die "couldn't open 'dev.csv': $!\n";
Hope this helps!while (my $read=<IN>) { print "3\n"; chomp ($read); #... }
In reply to Re: Reading a CSV file
by wade
in thread Reading a CSV file
by alchang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |