bobbybobbertson
Programmer
I just realized that I have a foreach statement in a bunch of my perl scripts that open a filehandle without closing it. The scripts work fine, but is there a need to fix this?
Or does perl automatically close a filehandle when another with the same name is opened?
my statement looks as follows:
foreach my $file_to_open (@files_to_open) {
open LOGFILE, $file_to_open or die "nogood $!";
#do work here
}
Or does perl automatically close a filehandle when another with the same name is opened?
my statement looks as follows:
foreach my $file_to_open (@files_to_open) {
open LOGFILE, $file_to_open or die "nogood $!";
#do work here
}