An operator is a symbol that tells the compiler to perform specific mathematical or logical operations, such as: 3+2=5 .
Perl language comes with a wealth of operators, so let’s take a lookat a few commonly used ones:
Arithmetic operator
Comparison operator
Logical operator
Assignment operator
Bit operator
Quotation mark operator
Other operators
Operator precedence
5.30.1. Arithmetic operator #
In the table instance, we set the variable $a as 10 and $b as 20 .
Operator | Description | Example |
|---|---|---|
| Addition operation | $a + $b results in 30 |
| Subtraction operation | $a-$b results in-10 |
| Multiplication operation | $a * $b the result is 200 |
| Division operation | $b / $a result is 2 |
| Remainder operation, remainder after division | $b $a result is 0 |
| Multiplying power | The result is 10 to the power of 20 |
Example #
#!/usr/bin/perl$a=10;$b=20;print"\\$a =$a,\\$b =$b\\n";$c=$a+$b;print'$a
+ $b ='.$c."\\n";$c=$a-$b;print'$a - $b ='.$c."\\n";$c=$a*$b;print'$a
* $b ='.$c."\\n";$c=$a/$b; print '$a/$b='. $c . "\n"; $c = $a % $b;
print'$a%$b='. $c. "\n"; $a = 2; $b = 4; $c = $a ** $b;
print'$a**$b='. $c . "\n";
The output of the above program execution is as follows:
$a = 10 , $b = 20
$a + $b = 30
$a - $b = -10
$a * $b = 200
$a / $b = 0.5
$a % $b = 10
$a ** $b = 16
5.30.2. Comparison operator #
In the table instance, we set the variable $a as 10 and $b as 20 .
Operator | Description | Example |
|---|---|---|
== | Check whether the values of the two operands are equal, and if so, the condition is true, otherwise false. | ($a = = $b) is false |
! = | Check whether the values of the two operands are equal, and if not, the condition is true, otherwise false. | ($a! = $b) is true. |
< = > | Check whether the values of the two operands are equal, return-1 if the number on the left is less than the number on the right, 0 if the number on the left is greater than the number on the right, return 1 if the number on the left is greater than that on the right. | ($a < = > $b) returns-1. |
> | Check whether the value of the left Operand is greater than the value of theright Operand. If so, the condition is true, otherwise it is false. | ($a > $b) returns false. |
< | Check whether the value of the left Operand is less than the value of the right Operand, and if so, the condition is true, otherwise false is returned. | ($a < $b) returns true. |
>= | Check whether the value of the left Operand is greater than or equal to the value of the right Operand, and if so, the condition is true, otherwise false is returned. | ($a > = $b) returns false. |
<= | Check whether the value of the left Operand is less than or equal to the value of the right Operand, and if so, the condition is true, otherwise false is returned. | ($a < = $b) returns true. |
Example #
#/ Usr/bin/perl $a=10$ B=20; Print " $a=$a, $b
=$b n "; if ($a==$b) {print" $a== $b result true n ";}else {print" $a== $b
Result false n ";} if ($a!=$b) {print" $a!= $b Result
True n ";} else {print" $a!= $b result false n ";} $c=$a<=>$b; print" $a
<=> $b returns the result of $c n "; if ($a>$b) {print" $a> $b
True n ";}else {print" $a> $b result false n ";} if ($a>=$b) {print" $a
>=\\$b result true n ";}else {print" $a>= $b result
False n ";} if ($a<$b) {print" $a< $b result true n ";}else {print" $a
< $bResult false n ";} if ($a<=$b) {print" $a<= $bResult
True n ";} else {print" $a<= $b result false n ";}
The output of the above program execution is as follows:
$a=10, $b=20
$a==$b result false
$a!=$ B Result true
$a<=>$b returns -1
$a>$b result false
$a>=$b result false
$a<$b result true
$a<=$b result true
In the following table example, set the variable $a to "abc" and $b to "xyz" , and then use a comparison operator to calculate the result.
Operator | Description | Example |
|---|---|---|
Lt | Check whether the string on the left is less than the string on the right, and return true if not, false otherwise. | ($a lt $b) returns true. |
Gt | Check whether the string on the left is larger than the string on the right, and return true if not, false otherwise. | ($a gt $b) returns false. |
Le | Check whether the string on the left is less than or equal to the string on the right, and return true if not, false otherwise. | ($a le $b) returns true |
Ge | Check whether the string on the left is greater than or equal to the string on the right, and return true if not, false otherwise. | ($a ge $b) returns false. |
Eq | Check whether the string on the left is equal to the string on the right, and return true if not, false otherwise. | ($an eq $b) returns false. |
Ne | Check whether the string on the left is not equal to the string on the right, and return true if not, false otherwise. | ($a ne $b) returns true |
Cmp | If the string on the left is greater than the string on the right, it returns 1, if equality returns 0, and if the string on the left is less thanthe string on the right, it returns-1. | ($a cmp $b) returns-1. |
Example #
#/ Usr/bin/perl $a="abc"$ B="xyz"; Print " $a=$a, $b
=$b n "; if ($alt $b) {print" $alt b returns true n ";}else {print" $a lt $b
Return false n ";} if ($agt $b) {print" $a gt $b Return
True n ";}else {print" $a gt $b returns false n ";} if ($ale $b) {print" $a
Le $b returns true n ";}else {print" $a le $b returns
False n ";} if ($age $b) {print" $a ge $b returns true n ";}else {print" $a
Ge $b returns false n ";} if ($ane $b) {print" $a ne $b returns
True n ";} else {print" $a ne $b returns false n ";} c=$acmp $b; print" $a
Cmp $b returns $c n ";
The output of the above program execution is as follows:
$a=abc, $b=xyz
Abc lt $b returns true
$a gt $b returns false
$a le $b returns true
$a ge $b returns false
$a ne $b returns true
$a cmp $b returns -1
5.30.3. Assignment operator #
In the table instance, we set the variable $a as 10 and $b as 20 .
Operator | Description | Example |
|---|---|---|
= | A simple assignment operator that assigns the value of the right Operand to the left Operand |
|
+= | Add the assignment operator to assign the result of the right Operand plus the left Operand to the left Operand |
|
-= | Subtract and assign the left Operand to the left Operand minus the result ofthe right Operand |
|
| Multiply and assign the operator to assign the result of the right Operand multiplied by the left Operand to the left Operand |
|
| Divide and assign the operator to assign the result of dividing the left Operand by the right Operand to the left Operand |
|
| Find the module and assignment operator, find the module assignment of two operands to the left Operand |
|
| Power and assignment operator to assign the power of two operands to the left Operand |
|
Example #
#/ Usr/bin/perl $a=10$ B=20; Print " $a=$a, $b
=$b n "; $c=$a+$b; print" After assignment $c=$c n "; $c+=$a; print" $c
=$c, operation statement $c+= $a n "; $c -=$a; print" $c=$c, operation statement $c
-=\\$a n "; $c *=$a; print" $c=$c, operation statement $c *= $a n "; $c/=$a;
Print " $c=$c, operation statement $c/= $a n"$ C%=$a;
Print " $c=$c, arithmetic statement $c%= $a n"$ C=2$ A=4; Print " $a=$a,
\\$c=$c n "; $c * *=$a; print" $c=$c, arithmetic statement $c * *= $a n ";
The output of the above program execution is as follows:
$a=10, $b=20
After assignment, $c=30
$c=40, operation statement $c+=$a
$c=30, operation statement $c -=$a
$c=300, operation statement $c *=$a
$c=30, operation statement $c/=$a
$c=0, operation statement $c%=$a
$a=4, $c=2
$c=16, operation statement $c * *=$a
5.30.4. Bit operation #
The bit operator acts on the bit and performs the operation bit by bit.
Set $a = 60 and $b = 13 , now represented in binary format, as follows:
$a = 0011 1100
$b = 0000 1101
-----------------
$a&$b = 0000 1100
$a|$b = 0011 1101
$a^$b = 0011 0001
~$a = 1100 0011
Perl supported bit operators are shown in the following table:
Operator | Description | Example |
|---|---|---|
& | If it exists in both operands, the binary AND operator copies a bit to the result. | ($a & $b) will get 12 with a binary of 0000 1100 |
If it exists in any Operand, the binary OR operator copies a bit into the result. | ($a | $b) will get 61 with a binary of 0011 1101 | |
^ | If it exists in one of the operands but not in both operands, the binary XORoperator copies a bit to the result. | ($a ^ $b) will get 49, with a binary of 0011 0001 |
~ | The binary anti-code operator is a unary operator with a “flip” bit effect, that is, 0 becomes 1, 1 becomes 0. | (~ $a) will get-61, the binary is 1100 0011, the inverse form of a signed binary number. |
< < | Binary left shift operator. The value of the left Operand moves the number of digits specified by the right Operand to the left. | $a < < 2 will get 240. the binary is 1111 0000. |
> > | Binary right shift operator. The value of the left Operand moves the number of digits specified by the right Operand to the right. | $a > > 2 will get 15, binary 0000 1111 |
Example #
#!/usr/bin/perluse integer;$a=60;$b=13;print"\\$a =$a,\\$b
=$b\\n";$c=$a&$b;print"\\$a &\\$b =$c\\n";$c=$a\|$b;print"\\$a \|\\$b
=$c\\n";$c=$a^$b;print"\\$a ^\\$b =$c\\n";$c= ~$a;print"~\\$a
=$c\\n";$c=$a<<2 2='$c\\n";$c=$a' ;print"\\$a <<>>2;print"\\$a >> 2
=$c\\n";
The output of the above program execution is as follows:
$a = 60 , $b = 13
$a & $b = 12
$a | $b = 61
$a ^ $b = 49
~$a = -61
$a << 2 = 240
$a >> 2 = 15
5.30.5. Logical operator #
Perl logical operators are shown in the following table.
In the table instance, we set the variable $a as true and $b as false .
Operator
Description
Example
and
Logic and operators. If both operands are true, the condition is true.
($an and $b) is false.
&&
C-style logic and operators. If both operands are true, the condition is true
($a & & $b) is false.
or
Logic or operator. If either of the operands is nonzero, the condition is true.
($an or $b) is true.
||
C style logic or operator. If either of the operands is nonzero, the condition is true.
($a || $b) is true.
not
Logical non-operator. Used to reverse the logical state of operands. If the condition is true, the logical non-operator will make it false.
Not ($an and $b) is true.
Example #
#!/usr/bin/perl$a=true;$b=false;print"\\$a =$a,\\$b
=$b\\n";$c=($aand$b);print"\\$a and\\$b =$c\\n";$c=($a&&$b);print"\\$a
&&\\$b =$c\\n";$c=($aor$b);print"\\$a or\\$b
=$c\\n";$c=($a\|\|$b);print"\\$a \|\|\\$b
=$c\\n";$a=0;$c=not($a);print"not(\\$a)=$c\\n";
The output of the above program execution is as follows:
$a = true , $b = false
$a and $b = false
$a && $b = false
$a or $b = true
$a || $b = true
not($a)= 1
5.30.6. Quotation mark operation #
Perl quote operators are shown in the following table.
Operator
Description
Example
Q{}
Add single quotation marks to a string
Q {abcd} result is’ abcd’
Qq{}
Add double quotation marks to a string
Qq {abcd} result is “abcd”
Qx{}
Add backquotes to a string
Qx {abcd} result is abcd
Example #
#!/usr/bin/perl$a=10;$b=q{a = $a};print"q{a =\\$a} =$b\\n";$b=qq{a
=$a};print"qq{a =\\$a} =$b\\n";# Executing the date command using
unix $t=qx{date};
print "qx{date}=$t\\n";
The output of the above program execution is as follows:
Q {a=$a}=a=$a
Qq {a=$a}=a=10
Qx {date}=Friday, June 10, 2016 16:22:33 CST
5.30.7. Other operators #
In addition to the operators we mentioned above Perl The following operators are also supported:
Operator
Description
Example
.
Dot (.) Used to concatenate two strings.
If $a = “run”, $b = “oob”, and $a.accounb results in “runoob”
X
The x operator returns the number of times the string is repeated.
(‘-‘x 3) the output is -.
(2. 5) the output is (2, 3, 4, 5)
++
Self-increment operator, the integer value increases by 1
$a = 10, $asides + output to 11
–
Self-subtraction operator, integer value minus 1
$a = 10, $aMel-output to 9
->
The arrow is used to specify the method of a class
$obj- > $a represents the $a method of the object $obj.
Example #
#!/usr/bin/perl$a="run";$b="oob";print"\\$a =$a,\\$b
=$b\\n";$c=$a.$b;print"\\$a .\\$b =$c\\n";$c="-"x3;print"\\"-\\"x 3
=$c\\n";@c=(2..5);print"(2..5) = @c\\n";$a=10;$b=15;print"\\$a =$a,\\$b
=$b\\n";$a++;$c=$a;print"\\$a implement\\$a++ =$c\\n";$b--;$c=$b;print"\\$b
implement \\$b-- =$c\\n";
The output of the above program execution is as follows:
$a = run , $b = oob
$a . $b = runoob
"-" x 3 = ---
(2..5) = 2 3 4 5
$a = 10 , $b = 15
$a implement $a++ = 11
$b implement $b-- = 14
5.30.8. Operator precedence #
The following table lists Perl operator precedence of the language:
Operator
Binding property
++,?--
None
-,?~,?!
From right to left
**
From right to left
=~,?!~
From left to right
*,?/,?%,?x
From left to right
+,?-,?.
From left to right
<<,?>>
From left to right
-e,?-r,
None
<,?<=,?>,?>=,?lt,?le,?gt,?ge
From left to right
==,?!=,?<=>,?eq,?ne,?cmp
From left to right
&
From left to right
|,?^
From left to right
&&
From left to right
||
From left to right
..
From left to right
??and?:
From right to left
=,?+=,?-=,?*=,
From right to left
Others
,
From left to right
not
From left to right
and
From left to right
or,?xor
From left to right
Example #
#!/usr/bin/perl$a=20;$b=10;$c=15;$d=5;$e;print"\\$a =$a,\\$b =$b,\\$c
=$c,\\$d =$d\\n";$e=($a+$b)*$c/$d; print "(\$a + \\$b) *
\\$c/\\$d=$e\\n";$e= (($a+$b) *$c)/$d; print"((\\$a+ \\$b)* \\$c)/\\$d
= $e\n"; $e = ($a + $b) * ($c/$d);print"(\\$a +\\$b) * (\\$c /\\$d )
=$e\\n";$e=$a+($b*$c)/$d; print "\$a + (\$b * \\$c )/\\$d=$e\\n";
The output of the above program execution is as follows:
$a = 20, $b = 10, $c = 15 ,$d = 5
($a + $b) * $c / $d = 90
(($a + $b) * $c) / $d = 90
($a + $b) * ($c / $d ) = 90
$a + ($b * $c )/ $d = 50
-
1. Geographical Information Systems in the World Wide Web Era
4
-
2. Basic technology of WebGIS
4
-
3. Geographic Web Services
5
-
4. aggregation of geographical information
4
-
5. mobile GIS
5
-
6. Geographic information portal
3
-
7. New generation national spatial data infrastructure and GIS
4
-
8. Application of WebGIS in E-Commerce
3
-
9. Application of WebGIS in E-government
3
-
10. Hotspots and frontiers of WebGIS
2
-
1. Angularjs2
8
-
1. SVG tutorial
19
-
1. Memcached
20
-
1. C# tutorial
61
-
1. Sqlite
47
-
2. Go
43
-
2. Docker
59
-
2. Vue3
19
-
2. Servlet
21
-
3. React
23
-
3. SOAP tutorial
10
-
3. Android
18
-
3. Mongodb
44
-
3. Kotlin
18
-
4. Lua
31
-
4. MySQL tutorial
34
-
4. Appml
12
-
5. Perl
45
-
5. Postgresql
41
-
web
15
-
5. Web Services tutorial
6
-
6. Ruby
41
-
6. Design-pattern
35
-
7. Django
18
-
7. Rust
22
-
6. WSDL tutorial
8
-
8. Foundation
39
-
9. Ios
43
-
8. Css3
26
-
9. Swift
43
-
11. HTML tutorial-(HTML5 Standard)
54
-
12. Http
6
-
13. Regex
6
-
14. Regexp
7
Principles, Technologies, and Methods of Geographic Information Systems
102
In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.
-
1. Introduction to Geographic Information Systems
6
-
2. From the Real World to the Bit World
3
-
3. Spatial Data Model
7
-
4. Spatial Reference Systems and Map Projections
5
-
5. Data in GIS
4
-
6. Spatial data acquisition
2
-
7. Spatial Data Management
6
-
8. Spatial analysis
8
-
9. Digital Terrain Model (DTM) and Terrain Analysis
5
-
10. Spatial modeling and spatial decision support
6
-
11. Spatial data representation and map making
6
-
12. 3S Integration Technology
5
-
13. Network Geographic Information System
4
-
14. Examples of Geographic Information System Application
8
-
15. Organization and Management of Geographic Information System Application Projects
10
-
16. Geographic Information system Software Engineering Technology
7
-
17. Geographic Information System Standards
3
-
18. Geographic Information System and Society
3
-
19. Earth Information Science and Digital Earth
4