From: Yitzchak Scott-Thoennes Date: Wed, 7 May 2003 23:37:47 +0000 (-0700) Subject: Re: [perl #16834] Anomolous behaviour of SUBSTR() used as LValue X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c67bbae06fa560d08982cd38476ff29fb39ec78d;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #16834] Anomolous behaviour of SUBSTR() used as LValue Message-ID: <7sfu+gzkg+AY092yn@efn.org> p4raw-id: //depot/perl@19456 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 6867857..d62f61a 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -5461,6 +5461,16 @@ replacement string as the 4th argument. This allows you to replace parts of the EXPR and return what was there before in one operation, just as you can with splice(). +If the lvalue returned by substr is used after the EXPR is changed in +any way, the behaviour may not be as expected and is subject to change. +This caveat includes code such as C or +C<(substr($foo,$a,$b)=$bar)=$fud> (where $foo is changed via the +substring assignment, and then the substr is used again), or where a +substr() is aliased via a C loop or passed as a parameter or +a reference to it is taken and then the alias, parameter, or deref'd +reference either is used after the original EXPR has been changed or +is assigned to and then used a second time. + =item symlink OLDFILE,NEWFILE Creates a new filename symbolically linked to the old filename.