| Next | Tricks of the Wizards | 173 |
my $it = make_iterator('foo-#-bar#');
for (1..105) {
my $s = $it->();
print "$s\n";
}
# Prints foo-0-bar0, foo-0-bar1,
# ...,
# foo-9-bar8, foo-9-bar9, ...
Easy change to make it stop and return undef instead of starting over.
Construct many iterators that all operate independently.
Pass iterators to functions, store in data structures.
| Next | ![]() |
Copyright © 2003 M. J. Dominus |