Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
-
Upload
dereasepiokio -
Category
Documents
-
view
220 -
download
0
Transcript of Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
1/10
Perl has quite an array of arithmetic operators. All of these work on variables that containnumbers. Many of the operators that are used in the C language are used in Perl as well.
+ (returns the sum of two numbers)- (returns the difference of two numbers)
* (returns the product of two numbers)/ (returns the quotient of two numbers)+= (add a number to a variable)-= (subtract a number from a variable)++ (increment a variable by 1)-- (decrement a variable by 1)
String Manipulation
Some of the operators on numbers have counterparts for strings as well.
. (returns the concatenated, or combined, string of two smaller strings).= (appends a string onto a variable)
Logical Operations
These are evaluated as being either True or False(1 or 0), and can help alter the flow ofyour program using conditional statements
&& (returns true if the first and second are true)|| (returns true if the first or the second are true)! (returns true opposite)
== (returns true if the first is equal to the second)>=
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
2/10
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
3/10
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
4/10
Robertadhi
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
5/10
kusuma
putrara thought of leaving his house robert adhi wantphotos and writing from right foot steppedoutside the room where where rt rw want tomate with the goal going into sudirman ThamrinKebayoran Lama Petukangan red pal Unilever
bans new market developments Hotel Indonesiaroundabout Gatot Subroto wish to see Televisionwant to go to the mandir room is alwaysfollowed by the army commander was shot fromhis room to get out of writing and his
subordinates followed
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
6/10
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
7/10
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
8/10
!=
Robert
adhi
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
9/10
kusuma
putrara thought of leaving his house robert adhi wantphotos and writing from right foot steppedoutside the room where where rt rw want tomate with the goal going into sudirman ThamrinKebayoran Lama Petukangan red pal Unilever
bans new market developments Hotel Indonesiaroundabout Gatot Subroto wish to see Televisionwant to go to the mandir room is alwaysfollowed by the army commander was shot fromhis room to get out of writing and his
subordinates followed
String Logical Operators
The same operators are different when a variable does not contain numbers.
eq (returns true if first string is equal to the second)
-
8/9/2019 Perl Has Quite an Array of Arithmetic Operators. All of These Work on Variables That Contain
10/10
ne (return true if first string is NOT equal to the second)
Some examples of these are:
$foo = $a+5;
$foo++;$foo += 10;$foo = "fu" . "bar";$foo .= "bar";
if ($foo==5){}if ($foo>10){}if ($foo>2 && $foo5) && ($foo!=10)){print "foo is between 5 and 10";}