in reply to about the application of arrow operator
G'day Winston,
Welcome to the Monastery.
From your question, I'm guessing this isn't your code; regardless, adding whitespace will usually make the code clearer. Here's how Perl sees it:
$ perl -MO=Deparse -e '$a->X*$b->X+$a->Y*$b->Y+$a->Z*$b->Z' $a->X * $b->X + $a->Y * $b->Y + $a->Z * $b->Z; -e syntax OK
If you're uncertain about the precedence, use the '-p' switch:
$ perl -MO=Deparse,-p -e '$a->X*$b->X+$a->Y*$b->Y+$a->Z*$b->Z' ((($a->X * $b->X) + ($a->Y * $b->Y)) + ($a->Z * $b->Z)); -e syntax OK
See also: B::Deparse; "perlop: Operator Precedence and Associativity"; and, perlop in general for operator documentation (for instance, "The Arrow Operator" section has links to information that you may not be aware of, such as the fairly new postfix dereferencing).
— Ken
|
|---|