title: Perl CSV to hash
body: <p>I have a CSV file that contains comment text prior to the header row and data, which I would like to read in as a hash for further manipulation.  The primary key have the hash will be a combination of two data values.  How do I?</p>
  
  <ol>
  <li>Search for the header row using pattern 'index'</li>
  <li>Use header for keys</li>
  <li>Read in rest of file.  </li>
  </ol>
  
  <p>Example CSV</p>
  
  <pre><code>#
  #
  #
  #
  Description information of source of file.
  
  index,label,bit,desc,mnemonic
  6,370,11,three,THRE
  9,240,23,four,FOR
  11,120,n/a,five,FIV
  </code></pre>
  
  <p>Example desired hash</p>
  
  <pre><code>( '37011' =&gt; { 'index' =&gt; '6', 'label' =&gt; '370', 'bit' =&gt; '11', 'desc' =&gt; 'three', 'mnemonic' =&gt; 'THRE'}, '24023' =&gt; {'index' =&gt; '9', 'label'  =&gt; '240', 'bit' =&gt; '23', 'desc' =&gt; 'four', 'mnemonic' =&gt; 'FOR'}, '120n/a' =&gt; {'index' =&gt; '11', 'label'  =&gt; '120', 'bit' =&gt; 'n/a', 'desc' =&gt; 'five', 'mnemonic' =&gt; 'FIV'} )   
  </code></pre>