I did it by creating an array of file IDs for each search word and then checking each element in one of the arrays to see if it existed in all of the others, and discarding it if it didn't.
HTH Nigel >>> David vd Geer Inhuur tbv IPlib <[EMAIL PROTECTED]> 06/25/02 02:51pm >>> Hello, I am currently working on a search-eingine for .txt files I am searching for $word in each .txt file. Now of course the ability to search for 2 words in the document, must become possible. Does any of you have an idea how to compare two hashes for the same entries ? I will show you : # ------------------------ find(\&files, $directory); # --- sub files { my $file = $File::Find::name || shift; next if($file =~ "ref.txt"); if ( $file =~ /\.txt$/ ) { open (FILE, $file); while (<FILE>) { $_ = lc ; if(m/$word/) { $results{$file}= $_; } } # End while } } # end sub files In here I will just have to build in a second : if(m/$second/) { $other{$file}= $_; } After this I change the lines to become html-minded the way I want it. I can of course do the same for %other and push it into @insecond. sub subst { for (sort keys %results) { s!/[^/]*\z!!; my $link = '/' . (split (/\//, $_, 4))[-1]; ($href = $_) =~ s(^.*/) (); push @in, "<tr><td>$href   </td><td>  <a href=${index}?load=y?dir=$_?href=$href>$link</a>  </td></tr>"; } } # End sub subst Make @in and @insecond uniq : sub uniq { my %saw; @out = grep(!$saw{$_}++, @in); } # End sub uniq And then of course print it : print "$_" foreach @out; But how do I print only those entries that excist both in @out and @outsecond ?? So in short : I want to match 2 words within .txt documents, if the document contains BOTH words I'dd like to print it. Your help is much apreciated !! Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ITM Business Solutions Unit 4 Nine Trees Trading Estate Morthen Road Rotherham S66 9JG Reception Tel: 01709 703288 Fax: 01709 701549 Help Desk Tel:01709 530424 Fax: 01709 702159 CONFIDENTIALITY NOTICE: This message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]