title: What is the value if you shift beyond the last element of an array?
body: <p>In this piece of code, shift is used twice, even though the method only takes one parameter:</p>
  
  <pre><code>sub regexVerify ($)
  {
     my $re = shift;
  
     return sub
     {
        local $_ = shift;
        m/$re/ ? $_ : undef;
     };
  }
  </code></pre>
  
  <p>What does this make the value of local $_, once shift is used again?  I was (perhaps naively) assuming that shifting into nothingness would result in undef.  But if that were true, this line has no meaning, right?:</p>
  
  <pre><code>m/$re/ ? $_ : undef;
  </code></pre>
  
  <p>The above sub is called like:</p>
  
  <pre><code>regexVerify (qr/^([a-z].*)?$/i);
  </code></pre>