# Create a hash with keys from @asdf my %hash; @hash{ @asdf } = (); # Use a hash slice. # Create a multidimensional datastructure: my $href; foreach my $key ( reverse @asdf ) { $href = { $key => $href }; }