You seem to want to read the file backwards (I guess that is why you have opened for append?). This is not really possible, use Super Search to find discussions on this. Have a look at File::ReadBackwards on CPAN, which might help.
Update: Sorry, I missed that you were reading into an array.
Wouldn't be easier to reverse @lines?
I don't know, would it be easier to reverse @lines?
Another programmer wrote this and I am trying work on it after the fact. And I don't know much perl..
I do appreciate the help.