in reply to Re^3: Scoping question - will file handle be closed? ("global")
in thread Scoping question - will file handle be closed?
You could have said, for example, 'Although globals including filehandles do not go out of scope, this behaviour can be avoided using the local keyword' (and then put your example).
Update: in your second example your variable is specifically of lexical scope, but there is an underlying global that gets assigned to $fh which doesn't go out of scope. OK looks like there's a trick going on here. $fh becomes \*{'::$fh'} which is a global that depends on a local. So although the filehandle isn't closed, it does become lexically inaccessible.
One world, one people
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Scoping question - will file handle be closed? ("global")
by tye (Sage) on Jul 28, 2015 at 13:59 UTC | |
by anonymized user 468275 (Curate) on Jul 29, 2015 at 10:32 UTC | |
by Corion (Patriarch) on Jul 29, 2015 at 10:46 UTC | |
by tye (Sage) on Jul 29, 2015 at 14:27 UTC | |
by tye (Sage) on Jul 29, 2015 at 13:58 UTC |