In Perl, the pop()
function is used to return the last value from an array. It removes the value from the array and returns it.
pop(Array)
This function takes an array that we want to pop the last element or value of.
This function returns the element that was popped out from the array. This is the last element of the array.
# create an array@languages = ("C","Java", "Python", "Perl");print "Before pop : \@coins = @languages\n";# pop array@popedElement = pop(@languages);# print array after popprint "After pop: \@gnaam = @languages\n";# print popped valueprint "Popped Value is @popedElement"
languages
.pop()
function, which pops the last element of the array.