title: Why am I getting "ARRAY(0x145030c)" trying to write a Perl hash to a file?
body: <p>I have a hash in which I store the products a customer buys (<code>%orders</code>). It uses the product code as key and has a reference to an array with the other info as value.</p>
  
  <p>At the end of the program, I have to rewrite the inventory to the updated version (i.e. subtract the quantity of the bought items)</p>
  
  <p>This is how I do rewrite the inventory:</p>
  
  <pre><code>sub rewriteInventory{
      open(FILE,'&gt;inv.txt');
      foreach $key(%inventory){
          print FILE "$key\|$inventory{$key}[0]\|$inventory{$key}[1]\|$inventory{$key}[2]\n"
      }
      close(FILE);
  }
  </code></pre>
  
  <p>where <code>$inventory{$key}[x]</code> is <code>0</code> &rarr; <code>Title</code>, <code>1</code> &rarr; <code>price</code>, <code>2</code> &rarr; <code>quantity</code>.</p>
  
  <p>The problem here is that when I look at <code>inv.txt</code> afterwards, I see things like this:</p>
  
  <pre><code>CD-911|Lady Gaga - The Fame|15.99|21
  ARRAY(0x145030c)|||
  BOOK-1453|The Da Vinci Code - Dan Brown|14.75|12
  ARRAY(0x145bee4)|||
  </code></pre>
  
  <p>Where do these <code>ARRAY(0x145030c)|||</code> entries come from? Or more important, how do I get rid of them?</p>