On Wed, Sep 17, 2003 at 11:58:27AM +0200, Robin Berjon wrote: > Nicholas Clark wrote: > > There's just been a long thread about this on p5p. > > I think that "not really" is the current answer, and it's proved impossible > > to cleanly write down what the order of evaluation is. > > In the above line, they evaluate right to left, because the RHS of the > > assignment is being evaluated first: > > (snip) > > Fun and games about evaluation order appeared with assigning to hash slices > > and array slices (for example) > > For simple assignments though, isn't it a necessity that it has to go RTL? > > $a = 1; > $b = 2; > $c = 3; > $a = $b = $c; > > This sets $a to 3. If evaluation didn't go RTL, $a would be set to 2.
I think we're talking cross purposes. The associativity of = is RTL, ie $a = $b = $c is $a = ($b = $c); The order of evaluation question is about what happens when $b and $c are expressions instead of simple scalars. Nicholas Clark
