#if, elseif, else
if ($myNumber == 5)
{
print "My Number is Five
";
}
elsif ($myNumber == 3.14)
{
print "My Number is Pi
";
}
else
{
print "My Number is neither Five nor Pi
"
}
#while loop
while ($myNumber != 0) #could do: until ($myNumber == 0)
{
print "My Number is: ", $myNumber, "
";
$myNumber -= 1;
}
print "
";
#for loop
for ($myNumber = 0; $myNumber < 5; $myNumber++)
{
print "My Number is: ", $myNumber, "
";
}
print "
";
#foreach loop
foreach my $currentElement (@myList)
{
print "The current element is: ", $currentElement, "
";
}