my %out_hash = (); @out_hash{@in_array, keys %in_hash} = (("0") x @in_array, values %in_hash);