while (1) { my $xda = int rand( 0+@aob ); if ( $aob[$xda][ $y - 1 ] ne "") { $aob[$x][$y] = $z + $aob[$xda][ $y - 1 ]; last; } }