# With "x" for my $i (0..$#count) { push @result, ($i) x $count[$i]; }