At 2:20 PM -0400 8/19/99, Rich Lafferty wrote: >I'm in the process of writing a droplet which fills in missing data in >a flatfile database. > >Unfortunately, it needs to make a complete pass of the database in >order to read in the information that it'll be using to fill in the >missing information. > >As far as I can tell, this means that I need to do two passes -- one >to build the hash that contains the information that will be missing >from some of the records, and another to go through and add the >information where it's missing. > >I can't for the life of me figure out a way in which I can do two >passes but still have a droplet -- in other words: > >while(<>) { > add_to_hash($_); >} > ># back to beginning of file here! > >while(<>) { > fill_in_missing_bits($_); >} > >.. and I can't get back to the beginning of the file. > >Suggestions? my @files = @ARGV; foreach my $file (@files) { open $file or die "Unable to open $file: $!\n"; while (<>) { # Pass 1 }; seek @_,0,0; #rewind the file #could also close, and reopen it. while (<>) { # Pass 2 }; }; -Jeff Lowrey ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org