Re: partial assignment using lvalue?

[email protected] (Piers Cawley) 30 Aug 2000 10:05:59 +0100
Newsgroups perl.perl6.language.subs
Message-ID <[email protected]>
Kenneth Lee <[email protected]> writes:

> dear all,
> 
> it seems all the "lvalue sub" RFCs haven't mentioned this.
> 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?

You can do that at the moment with tie magic. I posted a semi working
example to the fun with perl list a while back. It was more or less
painful to do. But it worked.

-- 
Piers