title: Perl, XML::Simple, and a troubling foreach loop
body: <p>I'm really new to Perl and a first timer to <a href="http://search.cpan.org/perldoc/XML%3a%3aSimple" rel="nofollow">XML::Simple</a>.</p>
  
  <p>I have a <code>foreach</code> loop (XML data already fed into <code>$xmlHash</code>)</p>
  
  <pre><code>foreach (@{$xmlHash-&gt;{$PROTEIN}-&gt;{$PEPTIDE}}) {}
  </code></pre>
  
  <p>That works 90 times when the $peptide key contains a multiple peptides. However, protein 91 (and many others after) have only a single peptide (a scalar value), which causes <code>perl</code> to throw</p>
  
  <pre><code>Not an ARRAY reference at C:\...
  </code></pre>
  
  <p>What is the best way to make the foreach loop also work with scalar <code>$PEPTIDES</code>?</p>