title: What is the reason for the warning that a lexical variable is "not available" within eval
body: <p>When an <code>eval</code> statement is within the scope of a lexical variable, that variable should be within the lexical context of the evaluated block. Moreover, lexical variables should be available in the lexical context of subs. </p>
  
  <p>Yet this doesn't work:</p>
  
  <pre class="lang-perl prettyprint-override"><code>use warnings;
  
  {
      package VLE;
  
      my $ln10 = 2.302585092994045684017991454684;
  
      sub reval {
          say eval $_[0] if @_;
      }
  }
  
  package VLE;
  
  reval( q($ln10) );
  </code></pre>
  
  <p>It results in:</p>
  
  <pre class="lang-none prettyprint-override"><code>Variable "$ln10" is not available at (eval 1) line 1.
  </code></pre>
  
  <p>But if I (uselessly) use the lexical variable anywhere in the block, it's suddenly available in the eval:</p>
  
  <pre class="lang-perl prettyprint-override"><code>use warnings;
  
  {
      package VLE;
  
      my $ln10 = 2.302585092994045684017991454684;
  
      sub reval {
          say eval $_[0] if @_;
          my (undef) = $ln10;
          return 0
      }
  }
  
  package VLE;
  
  reval( q($ln10) );
  </code></pre>
  
  <p>prints</p>
  
  <pre class="lang-none prettyprint-override"><code>2.30258509299405
  </code></pre>
  
  <p>Why does this happen?</p>
  
  <h3>Edit:</h3>
  
  <p>The destruction of references isn't the issue, since this code (which maintains a reference to <code>$ln10</code>) also fails:</p>
  
  <pre class="lang-perl prettyprint-override"><code>use warnings;
  
  {
      package VLE;
  
      my $ln10 = 2.302585092994045684017991454684;
  
      sub reval2 {
          say eval $_[0] if @_;
          my (undef) = $ln10;
          return 0
      }
  
      sub reval {
          say eval $_[0] if @_;
          return 0
      }
  }
  
  package VLE;
  
  reval( q($ln10) ); # still fails
  reval2( q($ln10) ); # works
  </code></pre>