# take the values in @array and use them as a hash slice to make all of the values 1 @hash{@array} = (1) x @array;