in reply to Re: While issues
in thread While issues
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; } }
|
|---|