Kevin Collins said:
Uhm, I think the {} clearly shows what the intentions are? I mean, I
can do my %array = @array; (And I am happy with that)
Yes, but think of it this way: you are defining a *slice* of a hash, not
(necessarily) the whole hash. Its the same reason you can't do:
my $var[2] = 'val';
You can't lexically scope only part of an array or a hash, you have to do
the whole thing.
But we aren't asking to lexically scope part of an array or hash, just to
be able to lexically scope an entire array or hash in the same statement
that initializes a portion of it. I don't see any fundamental reason it
wouldn't work, as far as I can tell it doesn't introduce any syntactic
ambiguity. It would just be a matter of adding a little more DWIM to the
language.
my() already does some extra gymnastics to get the scope right in
"while ( my $x ... )" and similar. Perl has never suffered from much
concern for the lexer and its difficulties, but the additional stress
could (to coin a phrase) be the straw that breaks the camel's back.
It would also break the parallelism between local() and my() (in addition
to ways it is already broken). "local( @hash{ @list})" already has a
meaning, and it's not to localize %hash as a whole, the way my() would
have to work.
Anno