title: For each object in array in perl
body: <p>I am trying to loop through each object in an array in Perl and I think I am making an obvious error.</p>
  
  <pre><code>my @members_array = [
      {
          id    =&gt; 1234,
          email =&gt; 'first@example.com',
      }, {
          id    =&gt; 4321,
          email =&gt; 'second@example.com',
      }
  ];
  
  use Data::Dumper;
  for my $member ( @members_array ) {
      print Dumper( $member );
  }
  </code></pre>
  
  <p>Expected output for first iteration</p>
  
  <pre><code>{
      id    =&gt; 1234,
      email =&gt; 'first@example.com',
  }
  </code></pre>
  
  <p>Actual output for first iteration</p>
  
  <pre><code>[{
      'email' =&gt; 'first@example.com',
      'id' =&gt; 1234
   }, {
      'email' =&gt; 'second@example.com',
      'id' =&gt; 4321
  }];
  </code></pre>
  
  <p>How do I loop through these elements in the array? Thanks!</p>