title: How do I efficiently create a perl hash of consecutive numbers?
body: <p>I need to create something like this:</p>
  
  <pre><code>my $valueref = {
      1 =&gt; 1,
      2 =&gt; 2,
      3 =&gt; 3,
      4 =&gt; 4
  };
  </code></pre>
  
  <p>Based on certain conditions, it might be up to 40, or 50 or 60. In each case it would be consecutive integers, as show in the example. Once created, it would never be changed, simply passed to a preexisting subroutine. Since both the keys and the values will be consecutive, I could also create the hash using a <code>for</code> loop. I was curious what would be the fastest and/or most efficient way to create the hash? Or if there was yet another way it could be done?</p>