When I run this code:
it only displays the last row in the data.txt file. How can I get it to ready each line and create an array for each line? How would a has be used here?open(FILE, "data.txt"); #opens data.txt in read-mode while(<FILE>){ #reads line by line from FILE which i +s the filehandle for data.txt chomp; @data = split(/,/,$_); } close FILE; #close the file. print "test:\t$_\n" foreach (@data);
In reply to problem with array by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |