To read the article online, visit

Using PerlScript to Create ASP Pages

What is Perl?
Perl is an interesting scripting language that attempts to bring together everything cool from all other languages (according to Larry Wall, the author of Perl). Perl has a religious-like following in the world of UNIX systems administrators, and is used for a wide variety of tasks. With the explosion of the World Wide Web, it was discovered that Perl could easily be used as a dynamic scripting side language for Web sites, and many dynamic Web sites running on UNIX platforms employ the use of many Perl scripts. If you ever visit a page with a .pl extension, chances are it is a Perl script.

I find Perl to be a fun language to program in, but it is not nearly as English-like as VBScript. Perl intrinsically supports three main data types: scalars, arrays, and associative arrays (hashes/Dictionaries). With these intrinsic datatypes, along with intrinsic file handling and regular expression capabilities, make Perl a very "useful" language, espcially for file processing. Perl has its roots in a myriad of languages like C, Fortran, awk, and sed, so its syntax is very far from VBScript. However, I think Perl is a language worth learning. If you already know C/Fortran or Java/JavaScript well, you will pick up Perl rather quickly.

To learn more about Perl, be sure to visit

OK, so What is PerlScript?
PerlScript is an ActiveX Scripting Engine put out by the good folks at ActiveState. From the ActivePerl Web site on, you can download ActivePerl, which contains Perl for Win32, Perl for ISAPI, and, most importantly, PerlScript.

When using an ASP page, you can tie into any compliant ActiveX Scripting Engine. The one most commonly used is the VBScript ActiveX Scripting Engine. However, there is nothing to prevent you from using another server-side scripting language like PerlScript. Once you've downloaded and installed ActivePerl on your Web server, you can begin to use PerlScript in your ASP pages (note that you can also use PerlScript in your WSH scripts as well)! To do so, you need to include the following line of code on your ASP pages that you wish to use PerlScript:

<% @LANGUAGE="PerlScript" %>

Now, start writing PerlScript code! As with JScript, PerlScript is case sensitive. Furthermore, PerlScript uses a prefix character to indicate the type of variable being used. For example, if you wanted to create a scalar variable, you need to prefix it with a $. (Scalar variables are variables that are not arrays or associative arrays. An example of a scalar would be a string, and integer, or whatnot.) To declare variables, use the keyword my in place of the Dim keyword in VBScript.

The ASP intrinsic objects are accessed by prefixing the object name with a $. For example, to output, "Hello, world!", you could do:

<% @LANGUAGE="PerlScript" %>
  $Response->Write("Hello, world!");

Each statement needs to end with a semicolon (similar to JScript). Note that rather than using a period to access a method of an object (as in Response.Write), an arrow is used (->). A slightly more involved ASP page follows:

<% @LANGUAGE="PerlScript" %>
  # Note that a pound sign denotes a comment
  my $name;
  $name = "Scott";
  $Response->Write("Hello, $name!");

Note that when using PerlScript, you simply place the variable name in the string. PerlScript will seach the output string for words prefixed by a $ and displays those as variables.

Now, this article wasn't intended as a tutorial for PerlScript. Rather, its intention was to inform you about the ability of using PerlScript as an alternative server-side scripting language.

Happy Programming!

Article Information
Article Title: Using PerlScript to Create ASP Pages
Article Author: Scott Mitchell
Published Date: Friday, February 11, 2000
Article URL:

Copyright 2017 QuinStreet Inc. All Rights Reserved.
Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers