my @keynames = (qw/first second third fourth/); my %hash; @hash{@keynames} = ('0') x @keynames;