Elizabeth Mattijsen via RT wrote:
>.VAR reveals the properties of the underlying container of the object
>it is used on.  For an array, this *IS* the same for each element.

No, .VAR really is yielding two different objects that behave differently.
It's not just the ancillary properties of the container; the contained
value can be reached from the .VAR object.  I don't see anything as simple
to use as getter and setter methods on Scalar to access the contained
value, but method calls on the Scalar that are not applicable to the
Scalar itself, such as .say, get passed through to the contained value.

> @a[0].VAR.say
22
> @a[1].VAR.say
33
> my $x = @a[0].VAR
22
> my $y = @a[1].VAR
33
> $x.WHAT.say
(Scalar)
> $y.WHAT.say
(Scalar)
> $x.say
22
> $y.say
33
> $x === $y
True

-zefram

Reply via email to