for my $dataset (@data) { my @out = push @{ $data[ $fileCount ]->{ shift @col } }, \@col; }