The LIST consists of new elements that are to replace the old ones.
Format:
splice(ARRAY, OFFSET, LENGTH, LIST)
splice(ARRAY, OFFSET, LENGTH)
splice(ARRAY, OFFSET)
# Splicing out elements of a list
@colors=("red", "green", "purple", "blue", "brown");
print "The original array is @colors\n";
@discarded = splice(@colors, 2, 2);
print "discarded are: @discarded.\n";
print "The spliced array is now @colors.\n";
|