# For @answ_hoa1, note that 2nd elem of 4th array is "-" and not "D" # because elem[last] in 2nd array ("B") has been *used* before my @answ_hoa1 = ( ["A","A","A","A"], ["B","B","-","B"], ["C","-","-","C"], ["D","-","D","-"], ); my @answ_hoa2 = ( ["A","A","-"], ["D","-","-"], );