in reply to array splicing

Think of splicing as 'cut and paste' for arrays.
@foo = splice @bar, offset, length, LIST
This does the following:
  1. Starting with $bar[offset], 'cuts' length elements from @bar.
  2. 'Pastes' the LIST (this may do nothing if LIST is empty) into @bar at that very point.
  3. Returns the items 'cut' in step 1 (and assigning them to @foo)
I looked at http://perldoc.com/perl5.8.0/pod/func/splice.html, and I admit that it's in need of short, simple examples, so here are some:
@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)
Hope this helps!
--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc