Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Remove the last element from a ...Remove the first element of an ... (Berikutnya)
Functions for real @ARRAYs

Append one or more elements to an array

Daftar Isi

  • push ARRAY,LIST

  • push EXPR,LIST

    Treats ARRAY as a stack by appending the values of LIST to the end ofARRAY. The length of ARRAY increases by the length of LIST. Has the sameeffect as

    1. for $value (LIST) {
    2. $ARRAY[++$#ARRAY] = $value;
    3. }

    but is more efficient. Returns the number of elements in the array followingthe completed push.

    Starting with Perl 5.14, push can take a scalar EXPR, which must hold areference to an unblessed array. The argument will be dereferencedautomatically. This aspect of push 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:

    1. use 5.014;# so push/pop/etc work on scalars (experimental)
 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Remove the last element from a ...Remove the first element of an ... (Berikutnya)