On Wed, 17 Sep 2003, Robin Berjon wrote:

> David Cantrell wrote:
> > On Wed, Sep 17, 2003 at 11:21:50AM +0200, Robin Berjon wrote:
> >>   sub foo { @_==2 ? shift->{foo} = shift : shift->{foo} }
> > 
> >                        ^^^^^          ^^^^^
> > Is the order of evaluation of those two shift()s guaranteed?
> 
> I thought about that as I was writing it, I normally use the $_[N] form. And in 
> fact, it doesn't work since (now that coffee has settled in) it seems logical 
> that the rhs gets evaluated before its assignment to the lhs, without which 
> chained assignments wouldn't work.
> 
> Ah well.
> 
> sub foo { @_==2 ? shift->{foo} = pop : shift->{foo} }

This is semantically different, and therefore not an appropriate answer.

S.

-- 
Shevek                                    http://www.anarres.org/
I am the Borg.                         http://www.gothnicity.org/

Reply via email to