title: Perl nesting hash of hashes
body: <p>I'm having some trouble figuring out how to create nested hashes in perl based on the text input.</p>
  
  <p>i need something like this</p>
  
  <pre><code>my % hash = {
  key1 =&gt; \%inner-hash,
  key2 =&gt; \%inner-hash2
  }
  </code></pre>
  
  <p>However my problem is I don't know apriori how many inner-hashes there would be. To that end I wrote the following piece of snippet to test if a str variable can be created in a loop and its reference stored in an array and later dereferenced.</p>
  
  <pre><code>{
      if($line =~ m/^Limit\s+$mc_lim\s+$date_time_lim\s+$float_val\s+$mc\s+$middle_junk\s+$limit  \s+$value/) {
          my $str = $1 . ' ' . $2 . ' ' . $7;
          push (@test_array_reference, \$str);
       }
  }
  foreach (@test_array_reference) {  
      say $$_;
  }
  </code></pre>
  
  <p>Perl dies with a not a scalar run-time error. I'm a bit lost here. Any help will be appreciated.</p>