I don't think either explanation above is terribly clear, so I'll expound a little. You are getting bitten by order of operations. As described in
Terms and List Operators (Leftward),
print ($foo & 255) + 1, "\n";
probably doesn't do what you expect at first glance. The parentheses enclose the argument list for print which is evaluated (printing the result of $foo & 255 ). Then one is added to the return value of print (usually 1). The result is something like this:
1 + 1, "\n"; # Obviously not what you meant.
To do what you meant properly, you must write:
print(($foo & 255) + 1, "\n");
Your code
print (1-1/2000)**$i;
is functionally equivalent to
(print (1-1/2000))**$i;
and not
print ((1-1/2000)**$i);
as you might think. The parentheses bind tighter to the
print than to the exponentiation operator.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.