The pop function pops off the last element of an array and returns it.
The array size is subsequently decreased by 1.
# Removing an element from the end of a list
@names=("A", "B", "C", "D");
print "@names\n";
$got = pop(@names);
print "$got\n";
print "@names\n";
Related examples in the same category