in reply to count lines, bottom to top

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?

Replies are listed 'Best First'.
Re^2: count lines, bottom to top
by Bennco99 (Acolyte) on Aug 11, 2006 at 16:24 UTC
    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.
      You obviously have other issues with hamdling files and the words of our sage monks has given the clues there. As for reversing the order of arrays:
      #!/usr/bin/perl -w use strict; use warnings; my @array1 = (1, 2, 3, 4, 5); my @array2 = reverse( @array1 ); print join(", ", @array1), "\n"; print join(", ", @array2), "\n"; exit;
      jdtoronto