Your initial solution was SO much better than mine. So that's the one I'm using.
I needed to find the first random non-blank element. Using shuffle worked, but I was looking for a neater and simpler way.
Again, thank you.
My final -
. Using 'defined' is actually better in this case than using "" or q{}. No warnings.while (1) { my $xda = int rand $total + 1; if ( defined $aob[$xda][ $y - 1 ] ) { $aob[$x][$y] = $z + $aob[$xda][ $y - 1 ]; last; } }
In reply to Re^2: While issues
by Dandello
in thread While issues
by Dandello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |