$athlete[$i][$j++] = $bug; #### $j = 0; foreach my $bug (@row) { #here $j == 0; so the following line would be #$athlete[$i][0] = $bug; $athlete[$i][$j++] = $bug #at this poing the $j == 1 because of the $j++ #on the previous line. print "\$i\$j is assignt $i:$j\n"; print "\@athlete[\$i,\$j] is assigned the value $athlete[$i][$j]\n"; #on the previous line you $j == 1 so you are refering to #$athlete[$i][1] which is not the same as what you set #but rather the value you will set the next time through. . . . #### print "\@athlete[\$i,\$j] is assigned the value $athlete[$i][$j-1]\n";