title: How can I use hashes as arguments to subroutines in Perl?
body: <p>I was asked to modify some existing code to add some additional functionality. I have searched on Google and cannot seem to find the answer. I have something to this effect...</p>
  
  <pre><code>%first_hash = gen_first_hash();
  %second_hash = gen_second_hash();
  do_stuff_with_hashes(%first_hash, %second_hash);
  
  sub do_stuff_with_hashes
  {
      my %first_hash = shift;
      my %second_hash = shift;
  
      # do stuff with the hashes
  }
  </code></pre>
  
  <p>I am getting the following errors:</p>
  
  <pre><code>Odd number of elements in hash assignment at ./gen.pl line 85.
  Odd number of elements in hash assignment at ./gen.pl line 86.
  Use of uninitialized value in concatenation (.) or string at ./gen.pl line 124.
  Use of uninitialized value in concatenation (.) or string at ./gen.pl line 143.
  </code></pre>
  
  <p>Line 85 and 86 are the first two lines in the sub routine and 124 and 143 are where I am accessing the hashes. When I look up those errors it seems to suggest that my hashes are uninitialized. However, I can verify that the hashes have values. Why am I getting these errors?</p>