Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: Pattern matching of a large dbm file (slow indexing) Keywords: pattern matching, assoicative array, dbm Message-ID: <1991May6.223013.7274@iwarp.intel.com> Date: 6 May 91 22:30:13 GMT References: <1991May6.163310.21805@ccu.umanitoba.ca> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 28 In-Reply-To: rahardj@ccu.umanitoba.ca (Budi Rahardjo) In article <1991May6.163310.21805@ccu.umanitoba.ca>, rahardj@ccu (Budi Rahardjo) writes: | For comparison, doing a grep thru a flatfile (with the same contents) | takes 2 secs. | | If I do several "@k = keys(%RECORD);", this is going to be | a problem. | | Is there a way I can iterate over dbm file without stepping thru | the index/keys ? (Basically doing a 'grep' on the contents). | Or maybe read the raw-dbm file (without the index), ie treat it | as a flat file ... You mean, like: while (($key,$val) = each(%RECORD)) { if ($key =~ /pattern/) { "someaction"; } } or do you mean something else? @_{4,3,2,1}=("hacker,","Perl ","another ","Just ");print while ($_,$_)=each _; -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/