How about something like this... open(IN, "hogfile.txt") or die $!; while(<IN>) { $oldestline=$line; $line=$newestline; $newestline=$_;
if ($line =~ "terms you want") { ## process oldestline and newestline for more matches } } Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com ----- Original Message ----- From: "Hans Holtan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 28, 2002 9:13 AM Subject: searching a large file > I am having a problem searching a large (600 mb) text file. What I > need to do is find a match with a short bit of text and then look up > to 200 characters forwards and backwards for other matches to > different short bits of text. I tried reading the file to memory > first and then doing the search, but it's a serious hog, and I need > to leave a lot of memory open for other operations. Does anyone have > suggestions on how I can do this while limiting memory usage, speed > is a factor but not paramount. > Thanks, > Hans > -- > > > > ________________________________________________ > > Hans E. E. Holtan > Graduate Student > UC Berkeley-Department of Plant and Microbial Biology > Plant Gene Expression Center > 800 Buchanan Street > Albany, California 94710 > U. S. A. > Phone: (510) 559-5922 > FAX: (510) 559-6089 > [EMAIL PROTECTED] > _________________________________________________ > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]