So, when we last left off, I left you lost in a tumultuous sea of data types, variables, and strings. Fortunately for you, you have the black Perl, the world's fastest ship and a magical compass to point you in the right direction. So let's prepare to sail, er, study, and mind the shoals.
Comparing numbers is similar to comparing strings, except it is more obvious. 1 is greater than 2, 1 is equal to 1, 0 is less than 50, etc. I know, it's complex, fourth grade math and whatnot.
$value_one = 3;
$value_two = 2;
if ($value_one gt $value_two)
{
print “3 is greater than 2!”;
}
Logical Operators
Symbol
What it Does
&&
AND
||
OR
!
NOT
Lastly, we come to the logical operators. These help set criteria for us to evaluate data with. We may want to write a program that asks if this value is greater than that value AND it is less than that value, do this. These are known as conditionals and we will discuss those in depth in the next tutorial.
That's it for this tutorial. In our next tutorial we will be dealing with Conditionals and Loops, so be sure to drop by and check it out or else I will be jobless and living on the street. I'll be that guy that asks for a dollar and then complains when all you give me is a dollar. How can I buy a bottle of rum for a dollar you cheapskate?