You are doing the same thing DBI (possibly) does, i.e., using the same hash reference. If you push '$save_it' onto an array or something, you'll end up with the same hash everywhere. You'd want to put the 'my $save_it' inside the loop. But then it'd be easier to use selectall_(hash|array)ref anyway as already suggested.