Apr 13, 2014, 11:58 AM
Post #2 of 3
Your code works perfectly, except that you should try to print @array instead of @removed:
Re: [colezka] Use splice to add
[In reply to]
which should print:
The splice function:
pebbles wilma dino fred barney betty
removes the elements of @array designated by offet and length and replaces them with list, if specified. Returns the elements that we removed.
splice @array, offset, [length, [list]]
Your length is 0, therefore no element is removed and @removed is empty. But 'wilma' has been added to the original @array.
(This post was edited by Laurent_R on Apr 13, 2014, 11:59 AM)