Operators in Perl 6
There are a few dozen built-in operators in Perl 6. To make the overview more structured, we will group them in groups corresponding to the categories that we described in the previous sections:
- Infix operators
- Postfix operators
- Circumfix operators
- Postcircumfix operators
In the following sections, we will examine operators of Perl 6 grouped into these categories. Within each category, operators are arranged in descending precedence.
Infix operators
Infix operators are probably the most commonly used operators in the language. They are also the most intuitive ones.
Assignment operators
The =
operator is an assignment operator. It is used to assign the value of its right-hand side operand to the variable on the left. In the simplest case, the operator is used like this:
my $a; $a = 42;
The action is not limited to scalars only. Arrays, hashes, or instances of classes (we will talk about classes in Chapter 8, Object-Oriented Programming) work are also processed as expected.
my @a...