in reply to Perl text file writing

you'll want to add the following beneath #!/usr/local/bin/perl
use strict; use warnings; use diagnostics;
The above lines will make Perl tell you what is going on when your script runs.
Also look into the CGI::Carp module. That will direct any errors to your browser window.

Replies are listed 'Best First'.
Re^2: Perl text file writing
by chromatic (Archbishop) on May 25, 2006 at 21:15 UTC

    I don't think that's helpful. Per my reading of the program, adding these lines will produce no significant extra output.

    Why not tell the querant how to test for errors?

      Good point.

      A simple way to see if your script finished running is to add a few more print statements before your closing html tags, like so:
      print MYOUTFILE "Testing 1 2 3"; #write text, no newline print MYOUTFILE "\n"; #write newline print "Wrote to file \n"; #if this doesn't show in the browser, #the script didn't write to the file close(MYOUTFILE); print "Closed MYFILE \n"; #if this doesn't show in the browser, #the script didn't close the file print "</body> </html>\n";
      In general, tachyon's CGI Help Guide has been invaluable when I was figuring out CGI.

      Update: Forgot to do ID tags.