Perl- searching for values in one file which could be present in another
<p>I have a file where the following list of products are mentioned :</p>

<pre><code>DL750-12D1
DL750-12D2
DL750-12D3
DL750-12D4
DL750-12D5
DL750-12D6
DL750-12D9
DL750-12D11
</code></pre>

<p>I have another file which contains list of JSON objects which are as follows:</p>

<pre><code> {
      "Type": "DL750-12D5",
      "ProductLevelSimCheck": false,
      "HWCompatibilityCheck": true,
      "FWVersionCheck": true,
      "ConfigCheck": true,
      "createdAt": "2016-07-23T04:00:00.000Z",
      "Active": true,
      "IMEIRequired": true,
      "HWCompatibility": "01 01 01 01 01 00 00 00",
      "FWVersion": "D6.57",
      "Config": "TMC02",
      "Generation": "Gen 2",
      "ModifiedBy": "chanakyav",
      "updatedAt": "2016-07-28T17:42:48.249Z",
      "id": "5794182ba6832e7056349c76"
    }
</code></pre>

<p>How does one search if the list of products listed in products page can be found in product JSON page. And is there a way to list if the product is not present in JSON page?</p>

<p>I have implemented the following code in perl, but doesn't fetch me any results :</p>

<pre><code>#!C:/Dwimperl/perl/bin/perl.exe 

use File::Slurp;

#open (PL, "C:/Pannaga/ProjDocs/Prod/products_list.txt");
#open FILE, "&lt;C:/Pannaga/ProjDocs/Prod/products_page_json.txt";
open(Out,'&gt;', "C:/Pannaga/ProjDocs/Prod/Output.txt");


my @file1 = do {
    open my $fh, "&lt;", "C:/Pannaga/ProjDocs/Prod/products_list.txt"
        or die "could not open $filename: $!";
    &lt;$fh&gt;;
};

$count =0;
for my $i (0 .. $#file1)
{

      $count++;
      $find = $file1[$i];

      print Out "$count --&gt;Line that matched $find\n";


my @line =  do {
    open my $fh2, "&lt;", "C:/Pannaga/ProjDocs/Prod/products_page_json.txt"
        or die "could not open $filename: $!";
    &lt;$fh2&gt;;
};

for my $j (0 .. $#line) {

    if (index($line[j], $file1[$i]) != -1) {
   print "'$line[j]' contains '$file1[$i]'\n";
}
}

      }

close(Out);
</code></pre>