in reply to Indexing two large text files

ok, you can put those lines into temp file and after indexing over you can replace file1 with temp file. For example:

While<file1> { $f1=$_; While<file1> { $f2= $_; if($f1 eq $f2) { print TF "$f2\n"; } } print TF "$f1\n"; } close TF; open F_1,"file1.txt"; while(<F_1>) { print F_1 "$_\n"; } close F_1;

Replies are listed 'Best First'.
Re^2: Indexing two large text files
by never_more (Initiate) on Apr 09, 2012 at 13:48 UTC
    Thanks bimleshsharma, but even writing to a file, the complexity is still O(N**2)? and when I reach the end of file2, I think I still need to move file2's handler to the beginning of file2?