in reply to Re: Usage of File Handles
in thread Usage of File Handles
Yeah, you can either use a positive integer as a file handle, or you can use a text label
Note that catfish1116 is using Perl 5.12 or better, in which case lexical filehandles are generally recommended. Also, to pick a nit, it's not a "text label", it's actually a "bareword filehandle", which is essentially a global variable, which is one of the reasons that such filehandles are usually not recommended anymore.
don't forget to close your opened file handles before the program ends
Although closing filehandles explicitly as soon as possible is a good idea, the way you've written this implies that Perl doesn't close filehandles automatically, but it does. Another advantage of lexical filehandles is that they are closed automatically as soon as they go out of scope.
Note that most of this has been discussed before. Lexical filehandles were introduced in Perl 5.6, so they are available even in your TinyPerl 5.6 and 5.8.
|
|---|