in reply to Alternative for push
Better is:
use strict; use warnings; my @array= qw(data1 data2); for (1 .. 7){ push @array, 'ree'; print "@array\n"; }
although if the print is for diagnostic purposes then:
my @array= (qw(data1 data2), ('ree') x 7); print "@array\n";
is better still.
|
|---|