Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

push

Appends one or more values to the end of an array, growing it as needed.

Treats the first argument as an array and appends all subsequent arguments to it. Array arguments are flattened (their elements are pushed individually, not as nested arrays). Returns the new number of elements in the array.

Synopsis

push @array, $value;
push @array, @more_values;
push @array, $v1, $v2, $v3;
my $new_len = push @array, $value;

See Also

pop, unshift, shift, splice