my @AoA; foreach (@transactions) { #there are dozens of employee numbers… push @{$AoA[$_]}, $_; }