The remaining problem is that you push \%row_data into your array, which is the same pointer to the same data structure (which gets written to three times until only the last row data remains) instead of a new one. The easiest way to generate a new hash every time through the loop is to change the third line of Unforgivens loop