Sam Vilain writes:
> Darren Duncan wrote:
> >Now I seem to remember reading somewhere that '===' will do what I want, 
> >but I'm now having trouble finding any mention of it.
> >So, what is the operator for reference comparison?
> 
> As someone who wrote a tool that uses refaddr() and 0+ in Perl 5 to 
> achieve the same thing, I agree with the need for such an operator.
> 
> I think that =:= compares *lexical* identity is fairly clearly spelled 
> out in S03.  However, we need a way to compare *value* /identity/ (not 
> equality or equivalence), without being subject to overloading etc.

I'm pretty sure that =:= does what you want.  If you have two scalar
references, you might have to spell it like this:

    $$x =:= $$y

And binding can't be overloaded[1], so you don't have to worry about
that.

Luke

[1] Or maybe it can, but like the prefix & operator in C++, only people
who really know what they're doing will overload it.

Reply via email to