in reply to Re: Order of operations, mutators, aliasing and whammies
in thread Order of operations, mutators, aliasing and whammies

As a Perl rule in general, assignments and operations take precedence over non-assignments.

Bullocks. Assignment has a low precedence. Perl has 24 levels of precedence for operators, and assignment only has precedence level 19. Furthermore, it's the comma that separates the expressions - what might be relevant is the associativity of the comma operator.

However, in the shown code, the problem lies neither with precedence or associativity. It lies with order of evaluation. And Perl defines order of evaluation only for a few operators: &&, ||, and, or, and the comma in scalar context.

Precedence has nothing to do with order of evaluation. Precedence is a compile time thing, it determines how the parse tree looks like. Order of evaluation is a run time thing, and the compiler/interpreter is free to determine the most efficient order of evaluation.

Abigail

  • Comment on Re: Order of operations, mutators, aliasing and whammies

Replies are listed 'Best First'.
Re: Re: Order of operations, mutators, aliasing and whammies
by Roger (Parson) on Sep 05, 2003 at 08:22 UTC
    Thanks for the explanation, I have filled in the hole in my understanding of the order of evaluations. :-D