title: Populate hash of hashes in Perl
body: <p>I want to know how to populate the following hash structure:</p>
  
  <pre><code>my $hash = {
      'user' =&gt; [
          {
              'id' =&gt; '1',
              'name' =&gt; 'John'
          },
          {
              'id' =&gt; '2',
              'name' =&gt; 'Pat'
          }
  
      ]
  };
  </code></pre>
  
  <p>I want to be able to dynamically populate this hash.  I want to loop around values from my database and push (add) new values (id, name) in order to populate the hash.</p>