use strict; use warnings; use Data::Dumper; #Populate the hash the first way. my @keys = qw(a b c d e f); my %hash; @hash{@keys} = (1,1,1,1,1,1); # first verse. print Dumper(\%hash); #clear %hash. for (keys %hash) { delete $hash{$_}; } print Dumper(\%hash); #Populate the hash the second way, using scalars and arrays. ${hash}{a} = 1; $hash{b} = 1; # proving brackets optional when setting hash values in $calar mode. @{hash}{('c','d')} = (1,1); @hash{'e','f'} = (1,1); # proving brackets optional when setting hash values in @rray mode # second verse, same as the first. print Dumper(\%hash);