my @a = (1..9); my %h; # hash slice @h{@a} = (); # Same thing but sets each value to 1 @h{@a} = (1) x @a;