If i understood your question correctly this should work for you. This can be done still efficiently.

open (GEN, "<general.txt") || die ("cannot open general.txt"); open (SEA, "<search.txt") || die ("cannot open search.txt"); undef $/; $gen = <GEN>; $sea = <SEA>; @gen = split /\n/, $gen; @sea = split /\n/, $sea; for $a (@gen) { @result = grep/^\Q$a\E$/, @sea; push (@final , @result); } print "Search string that matches against general data:\t@final";

Prasad


In reply to Re: compare two text files by prasadbabu
in thread compare two text files by juergenkemeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":