|more useful options|
Re: A Few Questions About IO::File (be explicit)by Anonymous Monk
|on Mar 18, 2013 at 15:04 UTC||Need Help??|
You can't go wrong with being explicit (close), it really depends on the rest of the code :)
undef can work, provided there is only ever a single reference / copy of filehandle, but won't close if reference count goes up my $copy = $fh; close will always close -- explicit is good (q:gimme some? a: some what? q: that over there; q: to the left; q: lefter; :)
But if you write in narrow scopes
implicit undef can work, as can explicit undef, as can explicit close
Which is better? print $fh $str or die $!; close $fh or die $! ? use autodie ? Whatever fits?
It's very convenient, but this isn't mentioned anywhere in the doc and I'm not sure whether this has any negative side effects.
Often the doc is a start of a reading list, not just Ctrl+F for "close" :)
IO::Handle lists the close method