In article <20010107215901.A9489@pembro26.pmb.ox.ac.uk>, Simon Cozens <simon@cozens.net> writes: > On Sun, Jan 07, 2001 at 08:56:32PM +0000, Ton Hospel wrote: >> > Fair enough. Try this: >> > I am returning a value from a subroutine. >> > The value I am returning is the value of the first parameter. >> > The value of first parameter of the subroutine is modifiable. >> > The value that I am returning is modifiable. >> > >> > Where's the fallacy? >> >> You are returning a COPY of the value of the first parameter. > > Not so! shift does not make a copy: > > % perl -le '$a= 1; print \$a;foo($a);sub foo { print \do { shift}} ' > SCALAR(0x80fa19c) > SCALAR(0x80fa19c) > > Remember that we are passing around *values stored in variables*. > Right (didn't know that until you and graham pointed that out). The essence seem to be we have *two* "lvalue" concepts: 1) Something we can assign to 2) Something we can get hold of (through a container) and so manipulate It has to be decided which one of these two meanings we should use Or maybe we should just make them the same concept, i.e., make things like this work: sub fun { shift()=5; }Thread Previous | Thread Next