From: "cadetg@googlemail.com" Message-ID: <1175176945.669754.20700@e65g2000hsc.googlegroups.com> Date: 29 Mar 2007 07:02:25 -0700 On 29 Mrz., 15:19, bugbear wrote: > cad...@googlemail.com wrote: > > Dear Perl Monks, I am developing at the moment a script which has to > > parse 20GB files. The files I have to parse are some logfiles. My > > problem is that it takes ages to parse the files. I am doing something > > like this: > > > my %lookingFor; > > # keys => different name of one subset > > # values => array of one subset > > > my $fh = new FileHandle "< largeLogFile.log"; > > while (<$fh>) { > > foreach my $subset (keys %lookingFor) { > > foreach my $item (@{$subset}) { > > if (<$fh> =~ m/$item/) { > > my $writeFh = new FileHandle ">> myout.log"; print $writeFh < > > $fh>; > > } > > } > > } > > How many key-value pairs does %lookingFor (typically?) have? > > BugBear The %lookingFor does maybe just have five key value pair but each value is a reference to an array which is holding in average 20 items. So in total that makes maybe 100 items for what I have to look for. Cheers -Marco