foreach Iterator Variable
- The variable is actually the element in the list or array:
@names = qw( Zim Gir Gaz Dib );
foreach $name (@names) {
$name .= " is the name\n";
}
print "@names";
continued...
| CPU: Perl, Fall 2005 | Perl, Week 3: More Arrays, Context, Subroutines, Lexical Variables | #19 |
@names = qw( Zim Gir Gaz Dib );
foreach $name (@names) {
$name .= " is the name\n";
}
print "@names";
continued...
| Copyright © 2005 Ian Langworth |