in reply to Delete lines as i read them

The best way is to not do that and instead just to remember the offset up to which you read last time. Perl will tell you where you are in a file. Deleting lines has the problem that if your program does not work right you have already removed part of the data your program should process.

Replies are listed 'Best First'.
Re^2: Delete lines as i read them
by pie-ence (Initiate) on Jan 20, 2010 at 22:58 UTC
    thanks for the advice. I did not know about tell, it could be very useful. Originally I did not want to have the program remember which line i read last time because for each file that is going to be a different point. I see the problem with deleting as I go but is that an issue if they are just intermediate files anyways? I was thinking (and tell me if this is just silly) that this way I could easily tell if I had got all the lines from every file.