1 |
keys(%dict) returns a list (array) of keys in %dict (in arbitrary order). This can be used with foreach construct:
|
2 |
foreach (keys(%mime)) { # $_ is default loop variable
-
print "\$mime{$_} = $mime{$_}\n";
|
3 |
}
|
4 |
values(%dict) is typically less useful. It returns an unordered list of values (with repetition) in hash %dict
|
5 |
each(%dict) returns a single, two-element list containing the "next" key-value pair in %dict. For example,
|
6 |
while ( ($key,$val) = each(%dict) ) { ... }
|
7 |
Every call to each(%dict) returns a new pair until it finally returns null. The next call to each() starts the cycle again...
|