Remember, I'm new. Be gentle. I'm simply trying to create a log file that will have the current date and timestamp as the filename. But I can't figure out what is wrong with my code. The only thing I can think of is that the filename I'm trying to use is to long.
my $localtime = scalar localtime;
my $tmp = ".txt";
my $logfile = $localtime.$tmp;
$logfile =~ tr/ /-/;
open( OUTFILE, ">$logfile" );
print OUTFILE "Hello";
And this is the error I get when trying to run:
print() on closed filehandle OUTFILE at log.pl line 12.