On Tue, Oct 14, 2014 at 11:06 AM, H.Merijn Brand <h.m.brand@xs4all.nl> wrote: > On Tue, 14 Oct 2014 15:43:40 +0100, "Paul \"LeoNerd\" Evans" > <leonerd@leonerd.org.uk> wrote: > > > On Tue, 14 Oct 2014 08:47:15 -0400 > > Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote: > > > > > Also, we have LVALUE refs. Is this feature actually > > > related to that? > > > > The things we have that are called LVALUE are the lvalues returned by > > the substr() function so that mutations of it can affect the original: > > > > my $str = "Hello world"; > > substr( $str, 0, 5 ) = "Goodbye"; <== assignment to an LVALUE > > is that (internally) different from using the 4-arg form (which I > prefer because it is much faster)? > Better examples: my $ref = \substr($str, 0, 5); $$ref = "Goodbye"; or sub f { $_[0] = "Goodbye"; } f( substr($str, 0, 5) ); B says no > If the assignment is optimized away, why is it slower? I'll try to look into it tonight.Thread Previous | Thread Next