BTW, you don't have to track the current line number yourself
(or prepend an empty string to your array so it doesn't start with zero).
Just use $. (Yes, dollar sign followed by period) it will contain the
current line number of the last read filehandle.