use Data::Dumper; my %hash; for my $key ('A'..'C') { for my $value (1..3) { push @{$hash{$key}}, $value; } } print Dumper(\%hash);