When I manipulate CSV files in Perl I often have a need to initialize an array with some number of same elements:
my $arr = [];
for my $i (0..$n-1) {
push @$arr, "";
}
Is there a way to do it in a more compact form?
Perfectly I would like to have an expression for this purpose, so that I can add missing columns easily:
f([@$some_tab, n_elems("", $column_number - scalar(@$some_tab))]);
I know how to write a function, but I never do it in 10-line scripts.