Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Indexing two large text files

by bimleshsharma (Beadle)
on Apr 09, 2012 at 13:29 UTC ( #964125=note: print w/ replies, xml ) Need Help??


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;


Comment on Re: Indexing two large text files
Download Code
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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://964125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-12-18 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (49 votes), past polls