in reply to Uniformly Populating an Array with Elements of Another Array
Update: Too late as always ;-)my @elems = qw(x y z); my @is = qw(foo) x 10; my @new = (); my $i = 0; my $j = 0; my $k = int(@is / @elems)-1; for ( $j=0; $j<@is; $j++ ) { push @new, $is[$j] . $elems[$i]; $i++ if $j % int(@is / @elems) == $k and $i+1<@elems; } print "@new";
|
|---|