@bar = 0..9; @foo = splice(@bar, 3, 2); # $bar[3] and $bar[4] are removed. # now @foo is (3, 4) and @bar is (0,1,2,5,6,7,8,9) @bar = 0..9; splice(@bar, 5, 0, 100, 200); # Note that the 'length' is zero. This means *nothing* is removed from @bar. # then, 100 and 200 are pasted in so # @bar is (0,1,2,3,4,100,200,5,6,7,8,9) @bar = 0..10; @foo = splice(@bar, 7, 3, 300); # $bar[7], $bar[8], and $bar[9] are removed, and returned # to @foo. the value '300' is inserted there. # now @bar = (0,1,2,3,4,5,6,300,10) # and @foo = (7,8,9)