Loops

             while (condition) {
instructions
.
.
.
}

              #!perl

$x = 0;

while ($x < 10) {
print "The value of x is: $x\n";
$x++;
}

print "All done. The value of x is now: $x\n";


             The value of x is: 0
The value of x is: 1
The value of x is: 2
The value of x is: 3
The value of x is: 4
The value of x is: 5
The value of x is: 6
The value of x is: 7
The value of x is: 8
The value of x is: 9
All Done. The value of x is now: 10
		print "You must be at least 15 years old...\n";
		@ages = (10, 12, 12, 14, 15, 17, 18);
		
		foreach $age (@ages) {
			print "You're $age... "
			if ($age >= 15) {
				print "that's old enough.\n";
			}
			else {
				print "that's not old enough.\n";
			}
		}