官术网_书友最值得收藏!

Operator classification

First, let's remind ourselves of some of the basic terminology that we need when talking about operators. Consider a simple example:

my $a = 10;
my $b = 20;
my $c = 0;
$c = $a + $b;
say $c; # 30

Let's concentrate on the following line of code:

$c = $a + $b;

Here, we tell the compiler to perform two actions—first, calculate the sum of the $a and $b variables, and second, assign the result to the third variable, that is, $c. There are two operators in this example—+ and =. Operators are presented by their one-character names. In this case, the names are chosen to copy the corresponding operators in mathematics. Later, we will see examples of other operators, which are not just a character. They can be, for example, a sequence of two or three non-alphabetical symbols, such as >= or <= operators. Or, they can be a string identifier, for example—cmp or eq.

主站蜘蛛池模板: 苏州市| 城固县| 高安市| 绥宁县| 方城县| 通化县| 兰州市| 敦煌市| 毕节市| 新沂市| 肇源县| 当雄县| 澄迈县| 晋城| 大邑县| 河北区| 格尔木市| 西华县| 稻城县| 郴州市| 武义县| 郴州市| 象州县| 银川市| 广河县| 泸西县| 城市| 田阳县| 京山县| 郁南县| 乐山市| 凤冈县| 康马县| 从化市| 虞城县| 法库县| 轮台县| 贡嘎县| 鄢陵县| 舒城县| 河北区|