$numHeaders and $numFooters probably won't ever exceed 10.
The file itself is typically around 6,000 lines.
I've thought of reading it in reverse- but then I still have to exclude the headers, so I have the same problem just in the opposite direction.