PDA

View Full Version : Please, help me make my first step in Perl



Victor
January 10th, 2001, 10:40
I’ve just started to learn Perl, and I’am trying to make the first script work, but it wouldn’t ;(
What am I doing wrong?

I found this example in a guide:

#!/usr/bin/perl
print "Content-type: text/html\n";
print "Hello!\n";

I followed all the instructions:
1) I uploaded this script (test.cgi) to my cgi-bin in Ascii mode
2) I did check the path to Perl on the server
(my host is below10host.com)
3) I did set permissions 755

In result, when I go to the url of test.cgi in my browser, I get: Internal Server Error 500.

What am I doing wrong?
Please, help!
Victor

KapTinKiRk
January 10th, 2001, 12:57
You only have one break between the Content Type, and the actual content so Perl thinks that "Hello!" is part of the header and gives an error.

All you need to do is add another break "\n" to the second line and it should work fine.

A working example is below, hope it helps.



#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello!\n";

Woofcat
January 10th, 2001, 13:00
Also make sure your path to perl is right...

Victor
January 10th, 2001, 18:40
I added \n and it worked!

Thank you very much!

PS. So, it means that the intro to Perl, I used, contained an error, doesn't it?