In Operators§
See primary documentation in context for infix :=
Binding operator. Whereas $x = $y
puts the value in $y
into $x
, $x := $y
makes $x
and $y
the same thing.
my $a = 42; my $b = $a; $b++; say $a;
This will output 42, because $a
and $b
both contained the number 42
, but the containers were different.
my $a = 42; my $b := $a; $b++; say $a;
This will output 43, since $b
and $a
both represented the same object.
If type constrains on variables or containers are present a type check will be performed at runtime. On failure X::TypeCheck::BindingType
will be thrown.
Please note that :=
is a compile time operator. As such it can not be referred to at runtime and thus can't be used as an argument to metaoperators.