Splicing to Remove Elements
To remove elements when splicing, specify fewer new elements (or no replacement elements) than elements to be replaced.
@lucky = (1,2,3,4,5,6,7,8);
splice(@lucky, 2, 3);
print "Lucky numbers are @lucky.\n";
Lucky numbers are 1 2 6 7 8.
Previous slide
Next slide
Back to first slide
View graphic version