title: Using a variable name as the key name in a hash (Perl)
body: <p>I have this block of Perl code that I want to simplify.  It's part of a subroutine, where a series of arguments are added to values to a hash of hashes.</p>
  
  <pre><code>$user{$account_num}{'item0'} += $item0;
  $user{$account_num}{'item1'} += $item1;
  $user{$account_num}{'item2'} += $item2;
  $user{$account_num}{'item3'} += $item3;
  $user{$account_num}{'item4'} += $item4;
  $user{$account_num}{'item5'} += $item5;
  $user{$account_num}{'item6'} += $item6;
  </code></pre>
  
  <p>You can see that the variable names are the same as the key names.  I seem to remember watching a friend do this kind of thing in one line once.  Something like:</p>
  
  <pre><code>[looping through input arguments]:
  $user{$account_num}{'variable_name'} += $variable_name;
  </code></pre>
  
  <p>Does anybody know of a way to do this?</p>