title: How do I obtain an array of counts in perl which includes zeros for keys which had zero count?
body: <p>I'd gladly appreciate some advice on this problem I am having with perl.</p>
  
  <p>If I have an array and it contains for example the following integers:</p>
  
  <pre><code>1, 2, 3, 1, 1, 1, 1, 7, 1, 4, 1, 1, 1
  </code></pre>
  
  <p>once I have computed counts of keys using a hash, the key to value pairs will be:</p>
  
  <pre><code>1 =&gt; 9, 2 =&gt; 1, 3 =&gt; 1, 4 =&gt; 1, 7 =&gt; 1
  </code></pre>
  
  <p>I can assign both sets of numbers (keys and values) to different arrays to use them later, however if I now want an array which looks like this: <code>(9, 1, 1, 1, 0, 0, 1)</code> with the values in positions corresponding to the keys, with <code>0</code>'s for keys which did not appear in the list, namely <code>5</code> and <code>6</code>, how would i code this in perl?</p>
  
  <p>Thanks!</p>