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

IO::File close on undef behaviour?

Thread Next
From:
Philip Potter
Date:
August 12, 2009 03:27
Subject:
IO::File close on undef behaviour?
Message ID:
91dd35300908120327i33b97c0ax12dfdc6ad8dbd0ba@mail.gmail.com
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?

Thanks,

Philip

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About