my @keys = qw(a b c d); my $hash_ref; @{ $hash_ref }{@keys} = (1) x @keys; print "$_\n" for keys %$hash_ref; __END__