title: Parsing the large files in Perl
body: <p>I need to compare the big file(2GB) contains 22 million lines with the another file. its taking more time to process it while using Tie::File.so i have done it through 'while' but problem remains. see my code below...</p>
  
  <pre><code>use strict;
  use Tie::File;
  # use warnings;
  my @arr;
  # tie @arr, 'Tie::File', 'title_Nov19.txt';
  
  # open(IT,"&lt;title_Nov19.txt");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  # my @arr=&lt;IT&gt;;
  # close(IT);
  open(RE,"&gt;&gt;res.txt");
  
  open(IN,"&lt;input.txt");
  
  while(my $data=&lt;IN&gt;){
      chomp($data);
      print"$data\n";
      my $occ=0;
  
      open(IT,"&lt;title_Nov19.txt");    
      while(my $line2=&lt;IT&gt;){
  
          my $line=$line2;
          chomp($line);
  
          if($line=~m/\b$data\b/is){
  
              $occ++;
  
          }
  
      }
  print RE"$data\t$occ\n";
  }
  
  
  close(IT);
  close(IN);
  close(RE);
  </code></pre>
  
  <p>so help me to reduce it...</p>