Re: partial assignment using lvalue?

[email protected] (Damian Conway) Wed, 30 Aug 2000 17:45:27 +1100 (EST)
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
   > currently we can do
   > 
   >   $str = "foo bar";
   >   substr($str, 4, 0) = "baz ";
   > 
   > and $str will become "foo baz bar". should we be able to do 
   > this with lvalue-subs? how can one returns "pointer" to a 
   > portion of a scalar?

	sub partial: lvalue {
		return substr($str,4,0);
	}

	# and later...

	partial() = "baz ";

(Though this doesn't seem to work under 5.6,
 at least not under i686-linux-64all)

Damian