#!/usr/bin/perl -w ################################ # This document explains how to # do calculations in perl # AAK: last modification: # Tue Sep 11 22:16:20 PDT 2012 # ############################## $x = log(3.21); #log (natural) $y = exp(8.1); #expolential function $z = $x ** $y; #exponent x^y $p= sqrt($z); $a = 10 % 4; #modulus $n = 5; $n += 1; # equivalent to $n = $n + 1 $n++; #same as previous one $n--; #same as prevous but subtracts #similarly: $n -=7; $n /= 3.2; $n *= 8; $m = 5; $m %= 3; # i.e: $m = $m % 3 $m **= 2; #equivalent to $m = $m **2 #comparison operators are: # # != (not equal) # == (equal) # > # < # >= # <= #logical operators are: # && : AND # || : OR