note
RonW
<p>The following also works, though is equally surprising that it is needed.</p>
<c>
my $lib;
use lib $lib = '.';
</c>
<p>This works because variables declared at one scope are accessible from scopes inside the declaring scope.</p>
<p>Unfortunately, there isn't a good way to change this. It can, and probably should be, documented in the page for <c>use</c> and, maybe, also in the page for the <c>lib</c> pragma.</p>
<p>(Maybe a warning could be added when parsing <c>use</c> to remind people that <c>my</c> inside <c>use</c> has no effect and suggest alternate syntax.)</p>
1198651
1198664