my @lines; # ... as before # instead of *your* push line, @facdata{@facfields} = @facrow; push @lines, \%facdata;