Iterator
- A pattern for returning a list
- Perl builds lists into the language.
for my $color ( $picture->colors() ) {
...
}
- Iterators are still useful
my $sth = $dbh->execute($sql);
while ( my $row = $sth->fetchrow_hashref() ) {
...
}
for my $color ( $picture->colors() ) {
...
}
my $sth = $dbh->execute($sql);
while ( my $row = $sth->fetchrow_hashref() ) {
...
}
| Copyright © 2005-2006 David Rolsky |