in reply to Hashes of Arrays

Be sure to always use strict; and use warnings; ... for example this line is incorrect:
my %aMenu = { label => "  A", MenuItems => [ @MenuItems ] };
And should be (warnings would have complained about it):
my %aMenu = ( label => "  A", MenuItems => [ @MenuItems ] );

As for your root issue, I think you're just looking for another level of hashing ..
# if @MenuItems actually has something it it, then MenuItems => [@M +enuItems] is fine # but for simplicity i just made it MenuItems => [] my %menus = ( a => { label => "  A", MenuItems => [] }, b => { label => "  B", MenuItems => [] }, c => { label => "  C", MenuItems => [] }, ); #OR: my %menus = map { lc($_) => {label => "  $_", MenuItems => +[]} } 'A' .. 'C'; # then: foreach my $app (map {lc $_} @sorted_applications) { push @{ $menus{$app}->{MenuItems} }, $app; }
or, if you don't know the A, B, C menus ahead of time, just make them on the fly as needed:
my %menus; foreach my $app (map {lc $_} @sorted_applications) { $menus{$app} ||= { label => "  ".uc($app), MenuItems => [] }; push @{ $menus{$app}->{MenuItems} }, $app; }