in reply to More while issues
Got it
sub rankdwn { my ( $yb, $chntot, $incrsdel ) = @_; my $cnd_a = $aod[$yb] =~ tr/a/a/; my $cnd_y = $aod[$yb] =~ tr/y/y/; while ( $cnd_y < $incrsdel && $cnd_a > 0 ) { my $xda = int rand( $chntot + 1 ); if ( substr( $aod[$yb], $xda, 1 ) eq 'a' ) { substr $aod[$yb], $xda, 1, 'y'; $cnd_a--; $cnd_y++; } } while ( $cnd_y < $incrsdel && $cnd_a == 0 ) { my $xda = int rand( $chntot + 1 ); if ( substr( $aod[$yb], $xda, 1 ) eq 'c' ) { substr $aod[$yb], $xda, 1, 'y'; $cnd_y++; } } return; }
Sometimes just having little things pointed out helps. Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: More while issues
by GrandFather (Saint) on Mar 04, 2011 at 03:18 UTC | |
by Dandello (Monk) on Mar 04, 2011 at 03:59 UTC | |
by ynonp (Initiate) on Mar 04, 2011 at 10:28 UTC | |
|
Re^2: More while issues
by poj (Abbot) on Mar 04, 2011 at 08:14 UTC |