in reply to Re: Re: Re: Re: Operator Precedence (unary negation and exponentiation)
in thread Operator Precedence (unary negation and exponentiation)

One of the most important parts of learning to do maths (and, as a mathematician I could, if pressed, put up a reasonable argument that programming is just another branch of maths) properly is the process of training your intuition -- usually by checking your intuition at the door and working through stuff step by step until you learn why your intuition was correct (or, rarely, incorrect). Probability theory is the classic area where almost every non-trivial result seems counter intuitive.

Coming back to this particular thing, negation is not quite the same as subtraction, it is a shorthand for it, and there is a right and a wrong time to expand it. For instance, it's perfectly valid to write 3 * -2. If Perl didn't treat negation as somehow 'special' then that would be a syntax error.