From: david nicol Date: Tue, 22 Apr 2003 22:05:02 +0000 (-0500) Subject: Document that splice() doesn't extend arrays X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3272a53d8ac41fb10d7f6637e3ffc4d16e9eb861;p=p5sagit%2Fp5-mst-13.2.git Document that splice() doesn't extend arrays Subject: Re: slice autoextending ? still another revised doc patch; COW Message-Id: <1051067101.1086.113.camel@plaza.davidnicol.com> p4raw-id: //depot/perl@19343 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 36999b9..721b890 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4722,13 +4722,13 @@ If both OFFSET and LENGTH are omitted, removes everything. If OFFSET is past the end of the array, perl issues a warning, and splices at the end of the array. -The following equivalences hold (assuming C<$[ == 0>): +The following equivalences hold (assuming C<< $[ == 0 and $#a >= $i >> ) push(@a,$x,$y) splice(@a,@a,0,$x,$y) pop(@a) splice(@a,-1) shift(@a) splice(@a,0,1) unshift(@a,$x,$y) splice(@a,0,0,$x,$y) - $a[$x] = $y splice(@a,$x,1,$y) + $a[$i] = $y splice(@a,$i,1,$y) Example, assuming array lengths are passed before arrays: