my $total; for my $x (0,1){ for my $y (0,1){ for my $z (0,1){ $total += $feld[$x][$y][$z]; } } } print $total;