Learning perl -- not working for me

software development

#1

Hey,
I just tried my first Perl script. it’s called index.cgi and the code is:

#!/usr/bin/perl

print “Hello world!\n”;
exit;

I get a 500 Server error. Any help?


#2

Kill exit; and make sure to: chmod 755 index.cgi

Don’t use exit unless you have to exit prematurely.


yerba# rm -rf /etc
yerba#


#3

As well as making your script executable (as mentioned by guice), you also need to print an HTTP header telling the browser what type of content it’s about to receive. So, before your first print statement, put:


#4

oh yah! oops…been too long since I’ve written CGI scripts. lol


yerba# rm -rf /etc
yerba#


#5

Thanks for the tips. It works now :slight_smile: