Login Register






[TUT] Perl Basic Maths and Variable's [Beginner LVL 2] filter_list
Author
Message
[TUT] Perl Basic Maths and Variable's [Beginner LVL 2] #1
Hey everyone and welcome to another Perl tutorial. In this tutorial we will be making a script that simply does simple maths so that we don't have to.
Extremely very simple but after a few tutorials you would be able to adapt it to become much better, so lets begin.


full code.
Code:
$num0 = 14257; $num1 = 123; $num2 = 25; $num3 = 182; print "$num1"+"$num2";

explained.

Code:
$num0 = 14257;
this is a Variable, all variables in perl start with $, it just set's a value to another object meaning the $num0 = 14257. That is the same for the three below it.

Code:
print "$num1"+"$num2";
this is where the maths happens all it is doing it adding the two variable $num1 and $num2.

The other Basic maths signs are:
+ Addition
- Subtraction
* Multiplication
/ Division


hope you enjoyed this tutorial on Variable's and Basic maths, In my later tutorial you will see how variables can be better used. This tutorial is very short as there isnt much more that can be said, the tutorials after go into a bit more detail on perl.
[Image: 6caf54.gif]

Reply