On Fri, Nov 01, 2002 at 11:51:17AM -0700, John Williams wrote:
> Right. ^= is rather pointless, because = already understands list
> context.
They're not quite the same because list assignment truncates first. To wit:
@a = [1,2,3];
@b = [4,5];
@a = @b; # @a gets [4,5]
@a ^= @b; # @a gets [4,5,undef]
And if you define = as an "intersection" rather than a "union" op, you'd get
@a ^= @b; # @a gets [4,5,3]
Maybe. Or there could be a truncation implicit in intersection operators.
> OTOH, you can get some different effects out of ^= by virtue of the
> "dimensionally replicate, quantitatively undef-extend" rule for vectoring
> operators.
>
> @a ^= @b # @a.length == max( @a.length, @b.length )
> @a ^= $b # all currently existing elements of @a are set to $b
> $b ^= @a # Yuck! $b = last element of @a.
Every possible utterance doesn't have to make practical sense...
Larry