Mega Code Archive

 
Categories / Perl / Array
 

Using push to insert elements at the end of @array

for ( $i = 1; $i <= 5; ++$i ) {    push( @array, $i );            # add $i to end of @array    print "@array\n";              # display current @array }