Perl Math Operators

[Solved] Perl Math Operators | Perl - Code Explorer | yomemimo.com
Question : perl math operators

Answered by : charlesalexandre-roy

# 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() |

Source : https://www.tutorialspoint.com/perl/arithmetic_operators_example.htm | Last Update : Thu, 10 Mar 22

Answers related to perl math operators

Code Explorer Popular Question For Perl