in reply to Printing to a file not working
Everyone else has nailed it -- permission issue (probably.) Just thought I could throw one more idea at you:
use strict; use warnings; use File::Temp qw/ tempfile tempdir /; my $dir = tempdir(); my ($fh, $filename) = tempfile( DIR => $dir ); print "Temporary file '$filename' created.\n"; print $fh "Stuff you want in the file.\n";
That will pretty much guarantee the creation of the file. It creates a unique subfolder inside of the $temp directory and creates a unique filename to write to. This is useful with webapps because each subsequent request won't clobber the previous file.
Kurt
|
|---|