in reply to File to array and reading back

As an alternative you could use either pairwise or each_array from List::MoreUtils

I'd use each_array but YMMV