On Sun, Jan 07, 2001 at 01:14:39PM +0000, Simon Cozens wrote: > On Fri, Jan 05, 2001 at 10:10:54AM -0800, Stephen McCamant wrote: > > If you like being able to assign to shift, I'd like to hear an argument why. > > I'm not assigning to shift, I'm assigning to the return value of the > subroutine. The documentation says it is possible to return a modifiable value > from a subroutine: sub foo : lvalue { shift } returns $_[0]. > I consider these to be equivalent: > > sub foo { $_[0] = 7; } foo($a) > sub foo :lvalue {shift} foo($a) = 7 > These are not equivalent: sub foo { $_[0] = 7; } foo($a) sub foo { shift = 7; } foo($a) So I don't know why you would expect your examples to be equivalent. "it is possible to return a modifiable value from a subroutine" does not at all mean the same thing as "all values returned from a subroutine are modifiable". RonaldThread Previous | Thread Next