my %Data; my $x = 0; foreach my $Name (@Names) { push @{$Data{$Name}->{Rank}}, $Dataset[$x]; push @{$Data{$Name}->{Salary}}, $Dataset[$x]; etc.. }