in reply to looping in 2d array

Here is the part of the code that isn't doing what I expect it to.

It would be nice to tell us what you expect your code to do, and in which respect it does not do that.

A couple of comments on your code. It has already been pointed out that the $i3 variable is not used in your loop, which seems to be a possible error (but we do not know since we don't really know what you are trying to do). Having said that, that loop would be more perlish this way:

for my $i3 (1..9) { # ...
Similarly, the other loop:
for my $i (0..$#textarray) { # ...
The important thing above is not so much the different syntax, but the fact that this code declares the $i3 and $i variables with the my operator and gives them a lexical scope. All your variables should be declared and you should always use the following pragmas:
use strict; use warnings;
near the top of your program. They will help you finding errors or deprecated/dangerous constructs.

Update: fixed a missing closing parenthesis in one of my loop examples. Thanks to AnomalousMonk for pointing out the typo through the chatterbox.