infix ===

Documentation for infix ===, assembled from the following types:

language documentation Operators

From Operators

(Operators) infix ===

sub infix:<===>(AnyAny)

Value identity operator. Returns True if both arguments are the same object.

my class A { };
my $a = A.new;
say $a === $a;              # OUTPUT: «True␤» 
say A.new === A.new;        # OUTPUT: «False␤» 
say A === A;                # OUTPUT: «True␤» 

For value types, === behaves like eqv:

say 'a' === 'a';            # OUTPUT: «True␤» 
say 'a' === 'b';            # OUTPUT: «False␤» 
 
# different types 
say 1 === 1.0;              # OUTPUT: «False␤» 

=== uses the WHICH method to obtain the object identity, so all value types must override method WHICH.