in reply to Opening multiple log files

There are advantages to using scoped variables, but I have found it simpler to use variables scoped to the procedure in perl 5.8.8, not to a loop or smaller subsection of code. So I declare all my variables at the subroutine level. It makes debugging a WHOLE lot easier. Also, I often have to save the position of a numeric looping variable and pass it to the line of code after the loop (not the case here, but people will ask why I do what I do.)
sub dosomething
{
my($fn,$fh);

}
Also, below you did not declare the DIR variable, and it is preferred to use it as a scalar now I believe. Plus you are using 'use strict'.
use strict;
my $DIR;
opendir ($DIR, $directory) or die "Could not open directory '$directory +': $!";