title: How to check whether one file's value contains in another text file? (perl script)
body: <p>I would like to check one of the file's values contains on another file. if one of the value contains it will show there is existing bin for that specific, if no, it will show there is no existing bin limit. the problem is I am not sure how to check all values at once.</p>
  
  <p>first DID1 text file value contain : </p>
  
  <pre><code>L84A:D:O:M:
  L84C:B:E:D:
  </code></pre>
  
  <p>second DID text file value contain : </p>
  
  <pre><code>L84A:B:E:Q:X:F:i:M:Y:
  L84C:B:E:Q:X:F:i:M:Y:
  L83A:B:E:Q:X:F:i:M:Y:
  </code></pre>
  
  <p>if first 4words value are match, need to check all value for that line. 
  for example L84A in first text file &amp; second text file value has M . it should print out there is an existing M bin </p>
  
  <p>below is my code : </p>
  
  <pre><code>use strict;
  use warnings;
  my $filename  = 'DID.txt';
  my $filename1 = 'DID1.txt';
  my $count     = 0;
  open( FILE2, "&lt;$filename1" )
    or die("Could not open log file. $!\n");
  while (&lt;FILE2&gt;) {
      my ($number) = $_;
      chomp($number);
      my @values1 = split( ':', $number );
      open( FILE, "&lt;$filename" )
        or die("Could not open log file. $!\n");
      while (&lt;FILE&gt;) {
          my ($line) = $_;
          chomp($line);
          my @values = split( ':', $line );
  
          foreach my $val (@values) {
              if ( $val =~ /$values1[0]/ ) {
                  $count++;
                  if ( $values[$count] =~ /$values1[$count]/ ) {
                      print
                        "Yes ,There is an existing bin &amp; DID\n @values1\n";
                  }
                  else {
                      print "No, There is an existing bin &amp; DID\n";
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I cannot check all value. please help to give any advice on it since this is my first time learning for perl language. Thanks a lot :)</p>