Horje
perl math operators Code Example
perl math operators
# Basic math operators:
|     Meaning    | Operator | Example     |
|:--------------:|:--------:|-------------|
| Addition       | +        | print 2+3;  |
| Subtraction    | -        | print 2-3;  |
| Multiplication | *        | print 2*3;  |
| Division       | /        | print 2/3;  |
| Modulus        | %        | print 2%3;  |
| Exponentiation | **       | print 2**3; |
# Note, the modulus operator is with the sigil that denotes a hash variable

# Basic math functions:
|         Function        |   Syntax  |
|:-----------------------:|:---------:|
| Absolute value          | abs()     |
| Integer                 | int()     |
| Natural log             | log()     |
| Square root             | sqrt()    |
| Random number up to num | rand(num) |
| Sinusoid                | sin()     |




14

Related
perl add to hash Code Example perl add to hash Code Example
perl if else Code Example perl if else Code Example
perl add to array Code Example perl add to array Code Example
perl do while loop Code Example perl do while loop Code Example
perl add key to hash Code Example perl add key to hash Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12