Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: LVALUE refsby xmath (Hermit) |
on Feb 16, 2003 at 14:09 UTC ( [id://235725]=note: print w/replies, xml ) | Need Help?? |
I haven't checked the sources, but empirical evidence made it clear to me there is only one LVALUE object per lexical occurrance of 'substr'.
This means for example that while this works:
this will not:
The work-around is to create a new lexical occurrance each time, by using eval STRING:
I hope this helps :-) (The obvious real solution is that substr() should check the refcount of the PVLV-object and create a fresh one if someone is still holding a reference to the previous one)
In Section
Seekers of Perl Wisdom
|
|