in reply to Do the Splice Docs on Length Need Tweak?
QM:
The documentation seems clear enough to me, but I can see where a little extra info could help. I think I'd suggest adding "If LENGTH is zero, nothing is removed. " just before the "If LENGTH is omitted" bit. It might also be helpful to rearrange the examples under "The following equivalences hold" bit with a couple comments:
# delete nothing but add to end or beginning of array: push @a,$x,$y splice(@a,@a,0,$x,$y) unshift @a,$x,$y splice(@a,0,0,$x,$y) # Remove first or last item from array: $t=pop @a $t=splice(@a,-1) $t=shift @a $t=splice(@a,0,1) # Replace item in middle of array $a[$i]=$y splice(@a,$i,1,$y)
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|