#variables used in the for example
$lower = 0; # lowest temperature
$upper = 300; # highest temperature
$step = 20; # increment step
# a simple for structure
for ($fahr = $lower; $fahr <= $upper; $fahr = $fahr + $step) {
$celsius = 5/9 * ($fahr-32);
print "$fahr $celsius\n";
}
#variables used in the foreach example
@users = ("pete","root","al");
#printing the values
print "\n\tThe users are $users[0], $users[1], and $users[2]\n";
# a simple foreach example
foreach $user (@users) {
print "\t$user is a Linux user\n";
}
This page is maintained by Al Bento who can be reached at abento@ubmail.ubalt.edu. This page was last updated on February 15, 2001. Although we will attempt to keep this information accurate, we can not guarantee the accuracy of the information provided.