develooper Front page | perl.beginners | Postings from August 2009

IO::File close on undef behaviour?

Thread Next
Philip Potter
August 12, 2009 03:27
IO::File close on undef behaviour?
Message ID:
Dear all,

I'm trying to learn to use the IO::File object as a means of passing a
filehandle from one function to another. In the perldoc documentation
for IO::File, it gives the example:

undef $fh;       # automatically closes the file

but in the reference that follows, it gives no indication for why this
might be the case. Would this behaviour be caused by the destructor?
If $fh goes out of scope, will the file be automatically closed? If
not, why does undef $fh; close the file and how would I find this out
in the reference manual?



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About