Documentation for routine
DESTROY assembled from the following types:
Closes the filehandle, unless its native-descriptor is
2 or lower. This ensures the standard filehandles do not get inadvertently closed.
Note that garbage collection is not guaranteed to happen, so you must NOT rely on
DESTROY for closing the handles you write to and instead close them yourself. Programs that open a lot of files should close the handles explicitly as well, regardless of whether they were open for writing, since too many files might get opened before garbage collection happens and the no longer used handles get closed.
.close. This method isn't to be used directly, but is something that's called during garbage collection.