Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

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


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names