On Thursday, May 30, 2002, at 05:51 , Peter Scott wrote:
> At 05:35 PM 5/30/02 -0700, drieux wrote:
[..]
>> inside another loop that is based upon the Max index value of
>> the keys in %decrHash - all of which are ints....
>
> And apparently >= 0 based on the code below too. Do these ints greatly
> exceed the number of keys in the hash? Might use an array otherwise,
> assuming you have no undef values.
I had to do the initialization or the 'if' whined at me... and
yes logically it has to be $key > 0.
[..]
>> I really wanted to do that with a 'shift' on the list returned
>> by sort - but it whined at me
>
> Because shift is prototyped to require an argument that starts with '@'.
I keep running into these places where I had hoped/expected
that it would take 'an autonomous list'....
>> now I want to do which one of these for what reason again????
>
> Seems like your application should be keeping track of the max value for
> other reasons...
not that I could figure out... so rather than having 'joe random'
hard coded value at:
if ( $total > $decrCount ) {
$take = $ModuleHash{($total % $modValue)};
} elsif ( exists( $decrHash{$total})) { # we are in range
$take = $decrHash{$total};
} else {
die "Way Weird - $total is not in play for some reason\n";
}
This way the branch-tree would be built upon the most probable
sweep through the data, since we do not have to worry if $total
is an index value in the $decrHash until total is down in the
weeds where we want to do those 'micro selects' - otherwise the
basic broad swath approach of doing the Modulo there is gooder
enough for nuclear weapons...
note:
my $modValue = keys %ModuleHash;
and I had thought about that - since the logic of the
hashes themselves is linear in nature...
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]