Lexical filehandles (what you get when you use open( my $fh, $mode, $path )) will automatically close the handle for you when the handle goes out of scope. Since $dbout_h in your example code is still in scope through the end of the file it's still a valid handle and wouldn't be automatically closed (and the buffers flushed). When you add the explicit close the buffers were flushed and you saw the contents.
Even using lexical filehandles (or as my habit since I've been working on older Perls, localized globs) I tend to put the explicit close. That way it's explicit where I expect the filehandle to become invalid and what not.
In reply to Re: Question on Filehandle: close function
by Fletch
in thread Question on Filehandle: close function
by prasadbabu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |