title: How can I diff two files in Perl?
body: <p>I have two text files which need to have the same values.</p>
  
  <pre><code>$ diff A.txt B.txt
  4a5
  &gt; I have this extra line.
  $
  </code></pre>
  
  <p>Open files in Perl</p>
  
  <pre><code>open (ONE, "&lt;A.txt");
  open (TWO, "&lt;B.txt");
  </code></pre>
  
  <p>How can I do such a diff from within Perl? Does Perl have a inbuilt diff or do I need to use the unix <code>diff</code> utility? I don't want to implement my own diff algorithm for this.</p>
  
  <p>I do need the information as to where my files differ, but I do not need to use the unix <code>diff</code> utility necessarily. That was just an example.</p>