Question: Can someone please explain to me the very basics of getting perl to work on a server. Do I need a module on the server? If so where does it go? What do I name my files and where do they go? 

From my understanding you need a module and it goes in the cgi-bin. I can't get a clear answer whether I name the file .pl or .cgi and when I put it in the cgi-bin I am getting a server error. I also have my permissions set to 777, so that shouldn't be the problem.

Please help! I just want to understand the how to get the very basic program working such as the one below. Thanks in advance!

```
    #!/usr/bin/perl
    require("cgi-lib.pl");
    print &PrintHeader;

    print "<html>";
    print "<head><title>Hello world!</title></head>";
    print "<body>";
    print "<p>Hello world!</p>";
    print "</body>";
    print "</html>";

```

Answer: 
The latest version of `cgi-lib.pl` is dated 1999 and is very out of date. I suggest you use the [`CGI`](https://metacpan.org/module/CGI) library instead, which is almost bound to be installed already on your server and is kept up to date (most recently on August 16 2012)

Your program should look like this:

```
#!/usr/bin/perl -- 

use strict;
use warnings;

use CGI ':standard';

print header;

print <<END;
<html>
  <head><title>Hello world!</title></head>
  <body>
    <p>Hello world!</p>
  </body>
</html>
END

```

Also note that you can run the program from the command line to see if it compiles and what output it generates. Once you have it working there you can move it to the server
The problem you are facing is you probably edited the source file on a Windows machine, which inserts a `CR` character before each linefeed. Make sure your code does not include any CRs or change the first line to:

```
#!/usr/bin/perl -- 

```

(that's two dashes and a space at the end of the line)