| Perl Programming | ||
|---|---|---|
| Loop Statements | ||
for (my $i = 10; $i >= 0; $i--) {
print "$i...\n"; # Countdown
}
foreach my $i (reverse 0..10) {
print "$i...\n"; # Same
}
%hash = (dog => "lazy", fox => "quick");
foreach my $key (keys %hash) {
print "The $key is $hash{$key}.\n"; # Print out hash pairs
}
The fox is quick.
The dog is lazy.
|
||
| Previous | http://stuff.mit.edu/iap/perl/ | Next |