<?xml version="1.0" encoding="windows-1252"?>
<node id="526494" title="Efficient code." created="2006-01-30 12:22:34" updated="2006-01-30 07:22:34">
<type id="115">
perlquestion</type>
<author id="323803">
murugu</author>
<data>
<field name="doctext">
&lt;p&gt;My friend is having two text files a and b. a is having 400 lines and b is having 50000 lines. He needs to compare the files and write in to a new log file where the matched contents should be written.
&lt;p&gt;My friend's boss thinks that fetching 'a' line by line and comparing it with the file b at a stretch is effecient. But what my friend suggested is to open the file 'b' line by line and compare it with a regular expression framed by joining all the lines of a with '|'. My friend asked me which one is better and efficient. I thought that what my friend suggested is efficient. 
&lt;p&gt;Monks, please suggest us which method we should go for. Is there any other effecient way to do this? 
&lt;p&gt;Million thanks in advance.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-323803"&gt;
&lt;p&gt;Regards,&lt;br&gt;Murugesan Kandasamy&lt;br&gt;use perl for(;;);
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
