|Just another Perl shrine|
reading file into an arrayby vassago (Novice)
|on Dec 05, 2008 at 20:39 UTC||Need Help??|
vassago has asked for the
wisdom of the Perl Monks concerning the following question:
I'm reading a file of 2-3000 lines into an array to process the data in the file. I'm using:
my @fileContents = <$file>
to just dump the whole file into the array. The problem I'm running into is that it appears that perl is breaking it into multiple arrays (two dimensional array) each holding 1000 lines. So when I do something like a for loop:
for(my $x=14; $x<@fileContents; $x++)
to read through each individual line it's only reading the first 999 lines and then stopping (if you are wondering, the data I need to look at starts on line 14). The reason I believe that it is breaking it into two dimensional arrays is because I'm using epic with eclipse and am in debug mode and that's what appears to be happening when I look at the array after the file is read into it.
I was contemplating trying to use:
while(<>) to read everything but I need to start on line 14 or I'm going to get errors.
Any help on this is greatly appreciated. Thank you.