my @keynames = qw/first second third fourth/; my @squares = map { $_ ** 2 } (1 .. 4); my %hash; @hash{@keynames} = @squares;