#!/usr/bin/perl -w use strict; use Data::Dumper; my @keys = (1,2,3); my %hash; @hash{@keys} = (undef) x @keys; print Dumper \%hash; __END__ Prints: $VAR1 = { '1' => undef, '3' => undef, '2' => undef };