in reply to problem with array
oropen(FILE, "data.txt") or die "$!"; while(<FILE>){ chomp; my @data = split(/,/,$_); print "test:\t$_\n" foreach (@data); } close FILE;
depending on whether you want to store all of the lines in the file in an array for later processing....my @lines; open(FILE, "data.txt") or die "$!"; while(<FILE>){ chomp; my @data = split(/,/,$_); push @lines,\@data; } close FILE; foreach(@lines){ print "test:\t$_\n" foreach (@$_); }
|
|---|