my %hash; my @keys = qw{ a b c d }; foreach ( @keys ) { $hash{$_}++; }