S
samwyse
In Python, I can say "7 * (1,)" to create a list of 7 items. If I need
a list in Perl with all elements initialized to the same value, is
there a one-liner? The best I can come up with is "$a[$n] = 0; pop
@a;" which will give me an array of $n undefs, but it seems a bit
inefficient. Any ideas? Thanks.
a list in Perl with all elements initialized to the same value, is
there a one-liner? The best I can come up with is "$a[$n] = 0; pop
@a;" which will give me an array of $n undefs, but it seems a bit
inefficient. Any ideas? Thanks.