my @input_array = ( 'N1','N2','N3','N6','N7'); my %hash = ( map { $_ => { A => 1, B => 1} } @input_array );