You are generating temporary files with invalid names and ignoring the function return code of open(). You should not
use the following code, but use one of the temporary filename creation methods available in CPAN modules (perhaps IO::File->new_tmpfile(), but there is probably a better one).
my $localtime = scalar localtime;
my $tmp = ".txt";
my $logfile = $localtime.$tmp;
$logfile =~ tr/ /-/;
open( OUTFILE, ">$logfile" ) or die "couldn't open $logfile\:$!\n";
print OUTFILE "Hello";