I think there's at least one more condition, namely: Do not assign a value that's greater than UINT_MAX.
No, that's not a precondition, because not assigning a value greater than (or equal to) "UINT_MAX" is exactly what the OP is trying to do.
but the result is one that I do not expect
It is not only the result the OP wants, it's the result you should expect since Perl's integer addition is implemented as a C integer addition. The result should be the 32 lower-order bits of the sum.
Alas, such handling of this corner case
integer clearly says it "only affects how most of the arithmetic and relational operators handle their operands and results, and not how all numbers everywhere are treated" and proceeds to list the specifics.
In reply to Re^4: perl arithmetic is killing me! HELP!
by ikegami
in thread perl arithmetic is killing me! HELP!
by harangzsolt33
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |