I want to check if two references point to the same object. It seems I can simply use

if ($ref1 == $ref2) { 
 # cheap numeric compare of references
 print "refs 1 and 2 refer to the same thing\n";
}

as mentioned in perlref, but I vaguely remember seeing the use of some function for the same purpose. Is there any reason I shouldn't use the simple numerical equality test?

Note I only want to know whether the references point to the exact same object. I don't look for a way to compare the content of the object(s).

Edit
Report