3.2.108 pop
pop
This function treats an array like a stack - it pops
and returns the last value of the array, shortening the array by 1.
If
$tmp = $ARRAY[$#ARRAY--]; or: $tmp = splice @ARRAY, -1; If there are no elements in the array, pop returns the undefined value. See also push and shift . If you want to pop more than one element, use splice . Note that pop requires its first argument to be an array, not a list. If you just want the last element of a list, use this: (something_returning_a_list)[-1] |
|