for (my $i=0; $i <= $#count; $i++) { push(@result, split("", $i x $count[$i])); } print "\@count: @count\n"; print "\@result: @result\n";