Questions about this topic? Sign up to ask in the talk tab.

Perl/Basics/Variables and Data Types/Helper Functions/Push

From NetSec
Jump to: navigation, search

The push() function is used to append an element or elements to the end of an array, similar to the push instruction in assembly and treats the array like a stack.

my @array;
push(@array,'element one');
push(@array,('element two','element three'));
You can also add to the end of an array with:
$array[$#array] = "new element";