in reply to How do I read a file line by line in reverse order (from EOF to start of file)

If you're on a unix (at least Linux) system, you can use the command 'tac' to reverse the lines in a file. so:
$/ = "\n"; open(REVERSE_FILE, "|/usr/bin/tac $filename"); while (<REVERSE_FILE>) { print "$_\n"; } close REVERSE_FILE;
  • Comment on Re: How do I read a file line by line in reverse order (from EOF to start of file)
  • Download Code

Replies are listed 'Best First'.
Re: Answer: How do I read a file line by line in reverse order (from EOF to start of file)
by Anonymous Monk on Dec 01, 2002 at 20:02 UTC
    I will put the pipe at the end:  "/usr/bin/tac $filename |"