Perl | Array pop() Function Last Updated : 07 May, 2019 Comments Improve Suggest changes Like Article Like Report pop() function in Perl returns the last element of Array passed to it as an argument, removing that value from the array. Note that the value passed to it must explicitly be an array, not a list. Syntax: pop(Array) Returns: undef if list is empty else last element from the array. Example 1: perl #!/usr/bin/perl -w # Defining an array of integers @array = (10, 20, 30, 40); # Calling the pop function $popped_element = pop(@array); # Printing the Popped element print "Popped element is $popped_element"; # Printing the resultant array print "\nResultant array after pop(): \n@array"; Output: Popped element is 40 Resultant array after pop(): 10 20 30 Example 2: perl #!/usr/bin/perl -w # Defining an array of strings @array = ("Geeks", "For", "Geeks", "Best"); # Calling the pop function $popped_element = pop(@array); # Printing the Popped element print "Popped element is $popped_element"; # Printing the resultant array print "\nResultant array after pop(): \n@array"; Output: Popped element is Best Resultant array after pop(): Geeks For Geeks Comment More infoAdvertise with us Next Article Perl | Array pop() Function C Code_Mech Follow Improve Article Tags : Perl Perl-function Perl-Arrays Perl-Array-Functions Similar Reads Perl | Useful Array functions In Perl, array is a special type of variable. The array is used to store the list of values and each object of the list is termed as an element. Elements can either be a number, string, or any type of scalar data including another variable. Array in Perl provides various inbuilt functions to perform 2 min read Perl | push() Function push() function in Perl is used to push a list of values onto the end of the array. push() function is often used with pop to implement stacks. push() function doesn't depend on the type of values passed as list. These values can be alpha-numeric. Syntax: push(Array, List) Parameter: Array: in which 2 min read Perl | split() Function split() is a string function in Perl which is used to split or you can say to cut a string into smaller sections or pieces. There are different criteria to split a string, like on a single character, a regular expression(pattern), a group of characters or on undefined value etc.. The best thing abou 8 min read Perl | shift() Function shift() function in Perl returns the first value in an array, removing it and shifting the elements of the array list to the left by one. Shift operation removes the value like pop but is taken from the start of the array instead of the end as in pop. This function returns undef if the array is empt 2 min read Perl | values() Function values() Function in Perl returns the list of all the values stored in a Hash. In a scalar context it returns the number of elements stored in the Hash. Note: Values returned from the value() Function may not always be in the same order. Syntax: values Hash Returns: list of values in the list contex 2 min read Perl | unshift() Function unshift() function in Perl places the given list of elements at the beginning of an array. Thereby shifting all the values in the array by right. Multiple values can be unshift using this operation. This function returns the number of new elements in an array. Syntax: unshift(Array, List)Returns: Nu 2 min read Perl | Multidimensional Arrays Multidimensional arrays in Perl are the arrays with more than one dimension. Technically there is no such thing as a multidimensional array in Perl but arrays are used to act as they have more than one dimension. Multi dimensional arrays are represented in the form of rows and columns, also knows as 6 min read Perl | grep() Function The grep() function in Perl used to extract any element from the given array which evaluates the true value for the given regular expression. Syntax: grep(Expression, @Array) Parameters: Expression : It is the regular expression which is used to run on each elements of the given array.@Array : It is 2 min read Perl | Arrays In Perl, array is a special type of variable. The array is used to store the list of values and each object of the list is termed as an element. Elements can either be a number, string, or any type of scalar data including another variable. Example: @number = (50, 70, 46); @names = ("Geeks", "For", 6 min read Perl | Array Slices In Perl, array is a special type of variable. The array is used to store the list of values and each object of the list is termed as an element. Elements can either be a number, string, or any type of scalar data including another variable. Arrays can store any type of data and that data can be acce 3 min read Like