Larry Wall schreef:
> Dr.Ruud:
>> larry:
>>> +Likewise, from the fact that list context flattens inner arrays and
>>> +lists, it follows that a reduced assignment does no special
>>> syntactic +dwimmery, and hence only scalar assigments are
>>> supported. Therefore +
>>> + [=] $x, @y, $z, 0
>>> + [+=] $x, @y, $z, 1
>>> +
>>> +are equivalent to
>>> +
>>> + $x = @y[0] = @y[1] = @y[2] ... @y[-1] = $z = 0
>>> + $x += @y[0] += @y[1] += @y[2] ... @y[-1] += $z += 1
>>
>> I assume that
>>
>> [=] $x, @y
>>
>> is equivalent to
>>
>> $x = @y[0] = @y[1] = @y[2] ... @y[-2] = @y[-1] [_edited_]
>>
>> then.
>
> Yes.
>> Or is a scalar required at the end?
>
> Yes, but @y[-1] is a perfectly fine scalar.
Yes, but I meant it more at a 'source-filter' level.
Suppose that you need to set everything to @y[0],
I think you can code
[=] $x, @y, @y[0] # looks clean, but does extra,
# but maybe in an efficient order
[=] $x, @y[1 .. *], @y[0] # hand-optimized?
[=] $x, @y.reverse # or does .reverse copy?
[=] $x, @y[reverse 0 .. *] # hi-brow?
and what not. (Pardon my French.)
--
Affijn, Ruud
"Gewoon is een tijger."