my %hash; m[(.+)-(\d+)] and push @{ $hash{$1} }, $2 for @CELLS;; pp \%hash;; { A => [1, 2, 3, 4], B => [5, 6], C => [7, 8] }