title: In Perl, how can I make a deep copy of an array?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/388187/whats-the-best-way-to-make-a-deep-copy-of-a-data-structure-in-perl">What&#39;s the best way to make a deep copy of a data structure in Perl?</a>  </p>
  </blockquote>
  
  
  
  <p>In my code i do:</p>
  
  <pre><code>@data_new=@data;
  </code></pre>
  
  <p>and then I change <code>@data</code>.</p>
  
  <p>The  problem is that <code>@data_new</code> always changes as well.
  It's like <code>@data_new</code> is just a reference to what's in <code>@data</code>.</p>
  
  <p>How do i make a copy of an array which is not a reference but a new copy of all the values?</p>
  
  <p><code>@data</code> is a two dimensional array, by the way.</p>