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.
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 pop print "After pop: \@gnaam = @languages\n"; # print popped value print "Popped Value is @popedElement"
pop()function, which pops the last element of the array.
View all Courses