in reply to Re^2: anonymous code blocks
in thread anonymous code blocks
The real advantage of storing file handles in variables is that you don't accidentally share a file handle. With global handles, this could be a problem. By using my, the variable is limited in scope.
Even though file handles in my variables close when their scopes end, it's considered good form to manually close the handle (and check the return status). Just because Perl could do something for you doesn't mean you should let it.
Phil
|
|---|