my %hash; for( @names_marks ) { %hash = split } # or, expanding split for( @names_marks ) { %hash = split ' ', $_ }