in reply to Where is the zero coming from?
InfiniteSilence is correct, of course. Here's what rand's documentation has to say:
rand EXPR
[...]
Returns a random fractional number greater than or equal to 0 and less than the value of EXPR.
In your code, @choices is used in scalar context and evaluates to its number of elements; since it's got 49 elements, you're essentially telling Perl that you want to a random number between 0 (inclusive) and 49 (exclusive).
So you're not only occasionally getting zero, you're also never getting the number 49.
|
|---|