title: How can I compare two files and show differences in Perl?
body: <p>I'm trying to write Perl script to compare the content of 2 files so that it would list out any differences seen.  Trying the following but I'm not sure how to continue further.  Note that following is only part of the script as I have sorted the content of the 2 files beforehand.  Thanks in advance.</p>
  
  <pre><code>open (FILE1, "log") || die ("Can't open file log for reading") ;
  open (FILE2, "master") || die ("Can't open file master for reading") ;
  
  @file1 = &lt;FILE1&gt; ;
  @file2 = &lt;FILE2&gt; ;
  
  #$perlcompare = (compare('log','master')== 0) ;
  #die ("Log and master files are equal and match.\n") ;
  
  if (@file1 eq @file2) {
  
  print "Log and master are equal and match.\n" ;
  } else  ????????????
  
  exit 0;
  </code></pre>