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.
undef if list is empty else last element from the array.
Popped element is 40 Resultant array after pop(): 10 20 30
Popped element is Best Resultant array after pop(): Geeks For Geeks