| Functions for real @ARRAYsRemove the last element from an array and return itDaftar Isi - pop EXPR
- pop
Pops and returns the last value of the array, shortening the array byone element. Returns the undefined value if the array is empty, although this may alsohappen at other times. If ARRAY is omitted, pops the @ARGV array in themain program, but the @_ array in subroutines, just like shift . Starting with Perl 5.14, pop can take a scalar EXPR, which must hold areference to an unblessed array. The argument will be dereferencedautomatically. This aspect of pop is considered highly experimental.The exact behaviour may change in a future version of Perl. To avoid confusing would-be users of your code who are running earlierversions of Perl with mysterious syntax errors, put this sort of thing atthe top of your file to signal that your code will work only on Perls ofa recent vintage: - use 5.014;# so push/pop/etc work on scalars (experimental)
|
| |
|