my @array = map { LISTS => [ map [], 1..$length ] }, 1..$arr_len;
P.S.: when you play with this, you'll sooner or later encounter
curious things like this:
my @array = map { 'foo' => $_ }, 1..3; # ok
my @array = map { $_ => 'foo' }, 1..3; # not ok: 'syntax error at .
+.., near "},"'
This is because Perl has to guess whether the {...} is an
anonymous hash or a block (remember, map supports
both map EXPR, LIST and map BLOCK LIST syntax).
In order to be sure what is meant, Perl would have to look ahead up
until after the corresponding closing curly to see if there's a comma
or not, which would disambiguate the interpretation. Perl doesn't do
this, because the closing curly could potentially be many lines
later... Rather, it expects you to help disambiguate early, like
with a unary plus in this case:
my @array = map +{ $_ => 'foo' }, 1..3; # ok
(see map for details)
|