in reply to How to combine rows of a spreadsheet

I found a clue to the disappearing records here Re: How do i create array of arrays. Changing:
push (@records, \@temp) if @temp;
to:
push (@records, [@temp]) if @temp;
Gets around the problem of my records being over-written. I welcome any pointers on the rest of the code or the overall strategy. TIA