August 1999 | Return to the Perl Hardware Store | Slide #33 |
my $it = make_iterator("access_log", "Lynx");
$line = $it->(); # Get next line
# Look for just the first line that has some property while (defined($line = $it->())) { print $line, last if $line =~ /LOD/; }
Construct many iterators that all operate independently.
Pass iterators to functions, store in data structures.
When done, throw away the object; the file will close automatically.
Next | Copyright © 1999 M-J. Dominus |