We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now



Medium Priority
Last Modified: 2013-12-25
I am trying very hard to get my HTML script to call a simple Perl script.  What is happening is that when the HTML calls the Perl script, the Perl script is brought up in WordPad.  What is going on please ?

I am under the impression that as long as I have Perl on my system, I have no need to call out to my ISP's cgibin directory.



To follow up to your answers:

Thanks for your answers.  I have enclosed the scripts as you asked.  I altered the H_KEY_CLASSES_ROOT as suggested; sure enough WordPad.exe was in there, so I took it out.

Now when I run the guest.htm and press submit to call the Perl script, it tells me that :  "This file does not have a program associated with it for performing this action.  Create an association in My Computer by clicking View and then clicking options."  So I went there, and under .PL files, it just says that the action is open.  I also checked out my MIME setup in the Registry and there was nothing referring to .pl files, just an entry for html/text, which had a few fields in it that obviously meant something, but not to me.

Regarding the question about my ISP's cgibin directory, what I meant was, I should be able to get this all to run on my PC, as long as I have all the necessary bits and pieces, correct?  Do I need to specify the location of perl.exe and perl100.dll in my Registry?

Any further help is much appreciated !  Sorry about lack of points for the answer, I seem to be running a little short.


Here is my Perl script :

#! perl
print("My name is Yon Yonson,\n");
print("I live in Wisconsin,\n", "I work in a lumbermill there.\n");

Here is the HTML that calls it (First.pl)

<title> MOUSEPADKING Guestbook</title>
<body background="whamback.gif" vlink="#FF00FF">

<center><h2>Add to our Guestbook</h2></center>

Give us some feedback; what would you like on your mousepad ?

  Is there a favorite picture that you would like us to put on your pad for you?    

<b>Put some picture in your life !!!!</b>

<a href="list.htm"><font size=+1 color="#000000" face="Times New Roman"><b>BACK</b></font></a>

<table border=0 cellpadding=10>
<td>Your Name:</td>
<td><input type=text name=name size=30></td>
<td><input type=text name=email size=40></td>
<td valign=top>Comments:</td>
<td><textarea name=comments cols=60 rows=4></textarea></td>
<input type=submit value="Add Entry"><input type=reset>


Watch Question

Can you list your HTML and perl script, as this sounds quite remarkable if true!

Can you list your HTML and perl script, as this sounds quite remarkable if true!

Can you list your HTML and perl script, as this sounds quite remarkable if true!
Two things could be happening:

FIrst, on your machine:
What's happening is your browser is prolly thinking that the perl script mime type is text/plain or associates files of the type .cgi or .pl as text files, and therefore decides to "download" and "view" them rather than execute them.

You should look (in the registry) under .pl or .cgi in HKEY_CLASSES_ROOT,  and see the "long name" of a perl file. It's probably perlfile or plfile or cgifile.  Check under that key if there's a shell subbkey, and an open key, and a command key under that, ie:


It may reference wordpad.exe in it.  If so, remove it.
You may also have to look under your mime types for cgi/pl and remove it being text/plain or text/html.

If you're running a web server, you have to get it to recognize .cgi or .pl as scripts.  I run NT4 Server and Internet Information Server, so I had to go under it's registry and tell it .cgi meant go do perl.

Basically, that's what's happening on your local system.

Second, on your 'net providor's machine:

At your web hosting (ISP) it may be that you cannot run a script anywhere but their cgibin.  You may have to ask them about that.
If you can run one in your web home, then make sure that the file is EXECUTABLE.  What could be happening is that the server doesn't see that your CGI is an executable script.  You should set the mode of the CGI file to 755. (permissions), if your host is UNIX.  That means the file is READABLE and WRITEABLE and EXECUTABLE by you, the owner of the file, and only READABLE and EXECUTABLE by others. (rwxr-xr-x).  If this is confusing, you need to brush up on a little unix file permissions.

Basically, you gotta let the web server know your file is an executable script.  As i said b4, ask your providor. or consult your web server doc (if that's the case)

You didn't provide a lot of intel in your question, so I hope I've explained it :)

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Edited text of question

Ok, yes, you should be able to run it locally if you wish.  Here's some things you should do:

1)  Your first line of your script should read:

This is so that when you upload it to a server, the server will know where Perl is and stuff.

2)  If you're running Microsoft's Internet Information Service, you drill through the registry to get to:
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/W3SVC/Parameters/Script Map/

Add a REG_SZ key ".cgi" with a REG_SZ value of "c:\Perl\Bin\Perl.exe %s %s" or your path to Perl.

This will tell IIS to run .cgi files w/Perl.

You should, even if you aren't running IIS, change .pl files for CGI to .cgi.

3) If you're not running IIS, check your server documentation for nessicary setup file/registry/.ini settings to get the server to run .cgi files w/perl.

4)Drill in your registry to:
HKEY_CLASSES_ROOT/.pl/ and see what the long name of file is (as before when you had to find it to remove wordpad).  Go to the HKEY_CLASSES_ROOT/plfile or whatever it specifies.

For HKEY_CLASSES_ROOT/perl(or whatever)/shell/open/command/ make sure the value is "perl.exe %1 %*" so that it will run .pl files with Perl in the shell.

Then add HKEY_CLASSES_ROOT/.cgi/ with the same value that HKEY_CLASSES_ROOT/.pl/ has.

You should, theoretically, now be able to do as you wish.

BTW, what Perl for win are you using PerlWin32?  To me, it's the best Perl port yet. :)

Happy scriptiing!

Ok, to summarize the registry:

Assuming you have HKEY_CLASSES_ROOT/.pl/ pointing to "perl", and Perl.exe is in c:\Perl\Bin:

The registry values would be:
HKEY_CLASSES_ROOT/.pl/ = "perl"
HKEY_CLASSES_ROOT/.cgi/ = "perl"
HKEY_CLASSES_ROOT/perl/shell/open/command = "perl.exe %1 %*"

And if you're running IIS on NT4.+:
HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/W3SVC/Parameters/Script Map/ -- add a value named ".cgi" equal to "c:\Perl\bin\Perl.exe %s %s"

Of course, c:\Perl\bin must be in your path...or wherever your perl binaries are.  Check your perl install docs to get it right.

That's all... :)

Also, your perl script won't actually run from an HTML unless it's called VIA a server...but it'll run just fine standalone (ie, you type some_file_name.pl on the command line).  That may be the biggest problem you're having.  A browser itself cannot run a cgi script.  That's a server-side thing.

Hope this all clears it up for you.  If you need a server, try http://www.w3c.org/ and pick up their FREE httpd.  THey've got one that runs under Win32, and does a good job.

Another web server you may want to try is Omni HTTPd. You can find it at:



I think that my problem is that I am trying to run it all on my machine.  I did not realize that a browser could not invike a Perl program; but then how was I supposed to know; I'm just a dumb Paddy.  Voodoo, just for you, I was a Fortran77 programmer in London for 3 years, back in the early 80s,  but California had my name on it, so now I experience the savours of American life! You both recommend servers for me to use, what is the difference between them and my ISP, Primenet ?

bye for now, topcat

Fortran!  Hehe.  Reminds me of ......cp/m....forth....et al.

HTTP servers are basically the same, save for different ways they handle server side includes and stuff.

JavaSoft has a really cool one called Jeeves that will run Java "servlets" - Java applets that run server side instead of on a client!  Pretty phat if you ask me.

And ColdFusion is a good server too.  I use Microsoft's IIS locally, but my pages are hosted on a Linux box running a stock httpd, so really cool server side scripting is basically nil.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.