use warnings; use strict; #fancy matrix my @matrix; #set to a blank 3d test matrix for my $i (0 .. 6) { for my $j (0 .. 6) { for my $k (0 .. 2) { $matrix[$i][$j][$k] = 0; } } } #set some values for matrix for my $j (0..2, 4..6) { my $i = 4; for my $k (0 .. 2) { $matrix[$i][$j][$k] = 1; } } for my $i (0..2, 4..6) { my $j = 4; for my $k (0 .. 2) { $matrix[$i][$j][$k] = 1; } } #the conditional problem child if ($matrix[0][4][0] == 1 and $matrix[0][4][1] == 1 and $matrix[0][4][2] == 1 and $matrix[1][4][0] == 1 and $matrix[1][4][1] == 1 and $matrix[1][4][2] == 1 and $matrix[2][4][0] == 1 and $matrix[2][4][1] == 1 and $matrix[2][4][2] == 1 and $matrix[4][4][0] == 1 and $matrix[4][4][1] == 1 and $matrix[4][4][2] == 1 and $matrix[5][4][0] == 1 and $matrix[5][4][1] == 1 and $matrix[5][4][2] == 1 and $matrix[6][4][0] == 1 and $matrix[6][4][1] == 1 and $matrix[6][4][2] == 1 and $matrix[4][0][0] == 1 and $matrix[4][0][1] == 1 and $matrix[4][0][2] == 1 and $matrix[4][1][0] == 1 and $matrix[4][1][1] == 1 and $matrix[4][1][2] == 1 and $matrix[4][2][0] == 1 and $matrix[4][2][1] == 1 and $matrix[4][2][2] == 1 and $matrix[4][4][0] == 1 and $matrix[4][4][1] == 1 and $matrix[4][4][2] == 1 and $matrix[4][5][0] == 1 and $matrix[4][5][1] == 1 and $matrix[4][5][2] == 1 and $matrix[4][6][0] == 1 and $matrix[4][6][1] == 1 and $matrix[4][6][2] == 1) { print "it worked"; } ;