my %H; for my $item (@bigarray) { push @{$H{$1}}, $item if ($item =~ /(A|B|C)/); }