- Perl Script: Insert, Replace or Delet the range of elements from an Array - splice

The Perl splice function is an array manipulation function and is used to remove, replace or add elements.
splice (@ARRAY, OFFSET, LENGTH, LIST)
where:
ARRAY - is the array to manipulate
OFFSET - is the starting array element to be removed
LENGTH - is the number of elements to be removed
LIST - is a list of elements to replace the removed elements with

The splice function returns:
in scalar context, the last element removed or undef if no elements are removed
in list context, the list of elements removed from the array

Below is simple perl script which demonstrate the use of this splice function, feel free to use and copy this code
Continue Reading...


source:http://linuxpoison.blogspot.com/2012/10/135781677516498.html