The following will trap some errors. Other problems could be related to your permissions, where you are outputting the stuff (/output.txt looks like it resides in the root directory, not in a directory writable by "nobody") at the beginning of the script do:
## Use the fabulous CGI.pm module is usually installed use CGI; my $C = CGI->new(); ## create a code ref to the DIE event handler $SIG{__DIE__} = \&my_die; ## create a sub to handle the dies sub my_die { print $C->header,$C->start_html; print qq(<p>@_</p>); print $C->end_html; }

and let it go.

When you use the CGI module you can also pass parameters to the script from the command line that you would pass from the form. i.e.:

$ ./my_script.cgi username=tenatious password=hideyho! age=1000 IQ=1

and lastly, make sure that the script is world executable:

chmod o+x my_script.cgi

In reply to Re: Perl to CGI by tenatious
in thread Perl to CGI by She-wolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.