title: What's the benefit of shifting @_ for argument passing in Perl?
body: <pre><code>sub foo {
   $arg1 = shift @_;
   $arg2 = shift @_;
   # ...
  }
  </code></pre>
  
  <p>What's the benefit of this idiom? I see only disadvantages compared to explicitly working with <code>$_[0]</code>, <code>$_[1]</code>, ... The array has to be shifted, which is time consuming. It is destroyed, so that at a later point in time, the arguments have vanished (sad if you need them again and have overwritten your $arg1 with a different value).</p>