A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://perldoc.perl.org/functions/pop below:

pop - Perldoc Browser

Removes and returns the last element of the array, shortening the array by one element.

my @arr  = ('cat', 'dog', 'mouse');
my $item = pop(@arr); # 'mouse'

# @arr is now ('cat', 'dog')

Returns undef if the array is empty.

Note: pop may also return undef if the last element in the array is undef.

my @arr  = ('one', 'two', undef);
my $item = pop(@arr); # undef

If ARRAY is omitted, pop operates on the @ARGV array in the main program, but the @_ array in subroutines. pop will operate on the @ARGV array in eval STRING, BEGIN {}, INIT {}, CHECK {} blocks.

Starting with Perl 5.14, an experimental feature allowed pop to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4