[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Two-pass droplet?



On Thu, Aug 19, 1999 at 02:20:17PM -0400, 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?

Use seek().  The filehandle's name is ARGV.  seek(ARGV,0,0) should
reset the file to the beginning.

} 
}   -Rich
} 
} -- 
} ------------------------------ Rich Lafferty ---------------------------
}  Sysadmin/Programmer, Information and Instructional Technology Services
}    Concordia University, Montreal, QC                 (514) 848-7625
} ------------------------- rich@alcor.concordia.ca ----------------------
} 

-- 
Paul Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org