Skip to content

Commit 8e543e3

Browse files
committed
doc Assignment Operators
1 parent b015b24 commit 8e543e3

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

doc/Language/operators.pod

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,25 @@ L</language/functions#Defining_Operators>.
110110
=head1 Meta Operators
111111
112112
=head2 Assignment Operators
113-
TODO
113+
114+
Most operators can be combined with the assignment operator to modify a
115+
value and apply the result to a container in one go. Containers will be
116+
autovivified if possible.
117+
118+
my $a = 32;
119+
$a += 10; # 42
120+
121+
my $a = 3;
122+
$a min= 5; # still 3
123+
$a min= 2; # 2
124+
125+
Z<blocked by #63642 my @a = 1,2; @a ,= 3,4;>
126+
127+
Although not strictly operators, methods can be used in the same fashion.
128+
129+
my SomeClass $a .= new;
130+
my $a = 3.14;
131+
$a .= Int; # 3
114132
115133
=head2 Negated Relational Operators
116134
TODO

0 commit comments

Comments
 (0)