2009/8/12 Shawn H. Corey <shawnhco...@gmail.com>: > Philip Potter wrote: >> >> 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? > > Yes.
Thanks very much for your answer. How would I find this out for myself, given that the documentation doesn't seem to explicitly say this? Does the documentation list it somewhere? > It is consider best practise to explicitly close the file so you can test > for errors: > > close $fh or die "could not close file: $!"; Ah, good point. Does this notation work on IO::File objects as well as $fh->close()? -- "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." --Bjarne Stroustrup -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/