Thank you, I see how this optimization should help. Unfortunatley it looks like File::ReadBackwards isn't very efficient. It reduced the page load time a bit, but not significantly.
I also tried having a separate script that just runs the tac command, and having the cgi call that script. But the "sh -c" effect that apache applies cascades to that script too. :-(