in reply to Scope of Filehandle inside Subroutine?
File handles aren't scoped. The variables which which they are associated are.
If the file handle is in a lexical variable, the file handle is lexically scoped.
If the file handle is in a package variable, the file handle is not scoped. The unqualified name of the variable is pacakge-scoped, but the variable doesn't cease to exist when executing code from another package. It's even accessible from other packages.
Using lexical variables is much preferred over using global variables.
|
|---|