I'm happy with the resulting script. It's far more clear and far less ugly.
Regarding some of the bogosities in my postulate:
Obviously, the line-by-line processing depends on whether the data file has each group of records on one line, or each record on a separate line. I went for the first assumption (as it makes more real-world sense to me) and you went for the second (as you had the patience to View Source).
That also lets me get away from the push reference position bit. Not a big loss.
I thought avoiding the implicit local $_ behavior in the while loop would be more clear for the OP.