Array Operations and Slices
Learn about array operations and array slices in Perl.
We'll cover the following...
We'll cover the following...
Array operations
Sometimes, an array is more convenient as an ordered, mutable collection of items than as a mapping of indices to values. Perl provides several operations to manipulate array elements.
The push and pop operators
The push and pop operators add and remove elements, respectively, from the tail of an array:
We may push a list of values onto an array, but we can only pop one at a
time. push returns the new number of elements in the array. ...