The Perl splice function is an array manipulation function and is used to remove, replace or add elements.
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...
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
0 comments:
Post a Comment