Setting up Apache to associate .pl files with Perl

Giganews Newsgroups
Subject: Setting up Apache to associate .pl files with Perl
Posted by:  Scott Bryce (sbry…
Date: Mon, 01 Apr 2013

I have a new computer that I am setting up to do web development.
Fortunately, I don't have to do this very often, but that also means
that I usually can't remember how I have done things in the past.

The OS is Windows 8.

I want to do CGI in Perl. I have Perl and Apache installed. Everything
works fine, except that I need to have a shebang line in my Perl
scripts. On my last development machine, Apache used the file
association in the OS (Windows Vista) to find the Perl interpreter. I
did not need a shebang line. I can't figure out how to set this up in
Windows 8.

The reason I want to do this is that I run the scripts on a Linux
server, which requires a different shebang than the Windows development
machine. I want to be able to use the Linux version of the shebang, but
have the shebang ignored on the Windows 8 machine. That way I don't need
to change the shebang when I upload the script to the server.

I have been searching for the solution to this for hours.