Context: ActiveState Perl: This is perl 5, version 12, subversion 4 (v5.12.4) built for MSWin32-x86-multi-thread
>perl -Mbignum=l -e "print 2 ** 32"
4294967296
>perl -Mbignum=l -e "print -2 ** 32"
-4294967296
Then I got to thinking, maybe I need to delimit the negative two.
>perl -Mbignum=l -e "print (-2) ** 32"
-2
Finally figured it out.
>perl -Mbignum=l -e "print ((-2) ** 32)"
4294967296
So how come all the parentheses?
This thread covers both of your questions (you have to go down a little to find the part corresponding to
print (-2) ** 32
).Summarizing what is there:
For your first issue (
perl -Mbignum=l -e "print -2 ** 32"
): in Perl exponentiation has higher precedence than unary negation.For the second issue (
perl -Mbignum=l -e "print (-2) ** 32"
): the key is the following warning in the documentation for print.