Iterating Through Hashes
- The each keyword can be used in a while loop
while ( my ($name, $prop) = each %fruit ) {
print "An $name is $prop.\n";
}
| CPU: Perl, Fall 2005 | Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables | #50 |
while ( my ($name, $prop) = each %fruit ) {
print "An $name is $prop.\n";
}
| Copyright © 2005 Ian Langworth |