Splicing and replacing elements of a list
@colors=("red", "green", "purple", "blue", "brown");
print "The original array is @colors\n";
@lostcolors=splice(@colors, 2, 3, "yellow", "orange");
print "The removed items are @lostcolors\n";
print "The spliced array is now @colors\n";
Related examples in the same category