from the command line type which perl and make sure you have the correct path
in your script.
Try running the program from your web browser (assuming your webserver is
properly set up).


As a side note for a cgi script I'd recommend using CGI.pm.
with cgi.pm this script would become

#!/usr/bin/perl -w

use strict;
use CGI;

my $q = new CGI;

print $q->header(),
          $q->start_html(-title=>'Hello world!'),
          $q->h1('Hello world'),
          $q->end_html;

neater and cleaner without  here docs.
CGI.pm is an awseome module It gives great insight into learning basic object
use in perl.


Aaron Dancygier

junkmail wrote:

>     Hey, so I'm having a weird problem maybe someone can help me with.
> I have a simple perl script named test.cgi that generates html (ie a cgi
> script) which looks like
>
> #!/usr/bin/perl
> # hello.pl -- my first perl script!
> print "Content-type: text/html\n\n";
> print <<"EOF";
> <HTML>
> <HEAD>
> <TITLE>Hello, world!</TITLE>
> </HEAD>
> <BODY>
> <H1>Hello, world!</H1>
> </BODY>
> </HTML>
> EOF
>
> If I type "perl test.cgi" (minus the quotes) the perl script runs.  If I
> type "./test.cgi" I got the error "bash: ./test.cgi: No such file or
> directory"
> If I remove the #!/usr/bin/perl line from the beginning of the perl script
> and "./test.cgi" again it runs but gives a lot of file not found errors.
> I'm guessing that somewhere there is an environment variable I am missing or
> something...  I have perl 5.6 installed and Mandrake 7.1 with the 2.2.16
> kernel.
> Any suggestions???
>
> Thanks
>
> Sam
>
>   ------------------------------------------------------------------------
> Keep in touch with http://mandrakeforum.com:
> Subscribe the "[EMAIL PROTECTED]" mailing list.


Keep in touch with http://mandrakeforum.com: 
Subscribe the "[EMAIL PROTECTED]" mailing list.

Reply via email to