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

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.

主站蜘蛛池模板: 宜宾市| 高安市| 海丰县| 邛崃市| 宜章县| 安远县| 铜陵市| 呼图壁县| 新竹县| 思南县| 都昌县| 江源县| 旅游| 七台河市| 湖州市| 高雄市| 浏阳市| 连平县| 繁昌县| 乐清市| 繁昌县| 扶沟县| 子长县| 彝良县| 江城| 富民县| 嘉兴市| 荃湾区| 渝北区| 昭平县| 大英县| 建阳市| 德格县| 肇源县| 沐川县| 河曲县| 隆回县| 麻栗坡县| 徐闻县| 磐石市| 凌云县|