From: bugbear Message-ID: <460bbcd5$0$8741$ed2619ec@ptn-nntp-reader02.plus.net> Date: Thu, 29 Mar 2007 14:19:17 +0100 cadetg@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