Copyright © tutorialspoint.com

# PERL push Function

## Syntax

push ARRAY, LIST

## Definition and Usage

Pushes the values in LIST onto the end of the list ARRAY. Used with pop to implement stacks.

## Return Value

- Number of elements in new array

## Example

Try out following example:

    #!/usr/bin/perl -w

    $, = ",";
    @array = ( 1, 2 );
    print "Before pusing elements  @array \n";
    push(@array, (3, 4, 5));
    print "After pusing elements  @array \n";

It will produce following results:

    Before pusing elements  1 2
    After pusing elements  1 2 3 4 5

Copyright © tutorialspoint.com