I'm looking for the Perlish way to create an array of n elements where each element is 0.
This is the best I could come up with:
#! /usr/bin/env perl
use warnings;
use strict;
use utf8;
use feature qw<say>;
print "Enter length of array: ";
chomp(my $len = <STDIN>);
my @arr = split // => "0" x $len;
say "@arr ", scalar(@arr);
I also look at List::Util's reduce but it wasn't as compact as the above snippet.