in reply to Should "use strict" complain if I use a variable that is not declared?
From perlsub:
"A my has both a compile-time and a run-time effect. At compile time, the compiler takes notice of it. The principal usefulness of this is to quiet use strict 'vars' , but it is also essential for generation of closures as detailed in perlref. Actual initialization is delayed until run time, though, so it gets executed at the appropriate time, such as each time through a loop, for example."
use strict 'vars' is checked at compiletime. Yet at compiletime, the compiler cannot know what the condition will be. It has to assume that under some conditions the variable will be declared, and that being the case, it must squelch the stricture complaint.
Dave
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Should "use strict" complain if I use a variable that is not declared?
by earthman (Initiate) on Jun 28, 2010 at 11:21 UTC | |
by Corion (Patriarch) on Jun 28, 2010 at 11:23 UTC | |
by ikegami (Patriarch) on Jun 28, 2010 at 19:40 UTC |