[Chapter 3] 3.2.112 push
Author: Larry Wall, Tom Christiansen & Randal L. Schwartz
Date: 1999-07-02T01:52:32Z

#

| Chapter 3 Functions |

### 3.2.112 push

    push ARRAY, LIST

This function treats `ARRAY` as a stack, and pushes the values of `LIST` onto the end of `ARRAY`. The length of `ARRAY` increases by the length of `LIST`. The function returns this new length. The push function has the same effect as:

    foreach $value (LIST) {
        $ARRAY[++$#ARRAY] = $value;
    }

or:

    splice @ARRAY, @ARRAY, 0, LIST;

but is more efficient (for both you and your computer). You can use push in combination with shift to make a fairly time-efficient shift register or queue:

    for (;;) {
        push @ARRAY, shift @ARRAY;
        ...
    }

See also pop and unshift.

3.2.111 printf |  | 3.2.113 q/STRING/