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
I concur with Dave Cross' comment, you need to tell your school that they are teaching you incorrectly. We in the Perl land are trying to get people to stop using the CGI module, and you are using its predecessor!

Here is a hello world app in a modern Perl framework, [Mojolicious](http://mojolicio.us):

```
#!/usr/bin/env perl

use Mojolicious::Lite;

get '/' => 'hello';

app->start;

__DATA__

@@ hello.html.ep
<html>
  <head><title>Hello world!</title></head>
  <body>
    <p>Hello world!</p>
  </body>
</html>

```

which you place into a file, (lets say `test.pl`). Install Mojolicious by running:

```
curl get.mojolicio.us | sh

```

and then start your app by running 

```
perl test.pl daemon

```

Now you can visit `http://localhost:3000` in your browser to see the result, no Apache, no cgi-bin needed!

A more fun example takes an "argument" with a default:

```
#!/usr/bin/env perl

use Mojolicious::Lite;

get '/:name' => { name => 'world' } => 'hello';

app->start;

__DATA__

@@ hello.html.ep
<html>
  <head><title>Hello <%= $name %>!</title></head>
  <body>
    <p>Hello <%= $name %>!</p>
  </body>
</html>

```

Run this and try visiting `http://localhost:3000/SilverNightaFall` and see what it does!

This process of interpolating dynamic values into your HTML is known as templating, and it is much preferred these days (vs generating your entire HTML on each request).