in reply to Re^2: Using an "outer" lexical in a sub?
in thread Using an "outer" lexical in a sub?
use strict; sub f { # strict still in effect in this child block if (...) { # strict still in effect in this child block for (...) { # strict still in effect in this child block { # strict still in effect in this child block } } } }
my $n; sub f { # $n is still accessible in this child block if (...) { # $n is still accessible in this child block for (...) { # $n is still accessible in this child block { # $n is still accessible in this child block } } } }
{ use strict; # strict still in effect } # strict no longer in effect
{ my $n; # $n accessible. } # $n no longer accessible.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using an "outer" lexical in a sub?
by Joost (Canon) on Nov 01, 2006 at 21:52 UTC |