my %hashes = map { $_ => {} } qw( testA testB testC ); # by hash my $i=0; $_->{'key'} = $i++ for values %hashes; # by name $hashes{$_}{'name'} = $_ for keys %hashes;