in reply to Re: reading file into an array
in thread reading file into an array

When i cut the file into about 500 lines it worked fine, but with my test file of 2800 lines it put out the wrong output. I have it running. I used:
while(<$file>){
...
}
and just used an arbitrary line counter to have it start processing the code once it hit line 14 and above. I just tested similar code but just had it read the file into the array and then print it out to a text file and checked the text file and it was all there so what I was seeing in eclipse was misleading (I think it breaks it into 1000 line chunks to make it easier to read through manually).
And I totally just had an 'aha' moment. I was parsing the date out of each line to test it against another file I had to make sure the lines I was comparing are the same date and time. Initially I was only taking the date from line 14 because I at first didn't realize one file would have multiple dates. So when I changed it to parse the date from every line I forgot to change the date reading from
$fileContents14 to $fileContents$x
So it wasn't looking like it was going through all the info because the test of making sure the same date is being tested failed for the whole document. And when I tested with only 500 lines the date changed to the correct date within the first 14 lines.
I don't know if much of that made sense without knowing what the program does and stuff but I now feel stupid for posting this question. I seriously played with this for hours before posting and couldn't figure it out, though.

Replies are listed 'Best First'.
Re^3: reading file into an array
by gwadej (Chaplain) on Dec 05, 2008 at 21:39 UTC

    It has been my experience that the two best ways to solve a problem are:

    • Ask the question in public where lots of people can see what's confusing you.
    • Tell your boss you can't solve it.

    Either of these activities will cause the solution to manifest itself in very short order.

    G. Wade