Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In order to write more interesting scripts, you will need to know about control structures.
An if statement tests to see if a condition is true. If it is, the following block of code is executed. This example tests to see if the value of $x is less than 0. If so, it multiplies by –1 to make it positive: