How to Create a PERL File

How to Create a PERL File thumbnail
The computer language Perl is interpreted, not compiled.

Perl is a high-level programming language that is used for manipulating text files, system administration tasks and network programming. After installing Perl on your computer or server, you can write your first Perl script. Ask your Web hosting company where Perl is installed on the server if you are unsure. The first line of every Perl script must include a commented-out line that is directed to the Perl interpreter that is installed on your server. The installation location varies slightly between Linux, Unix and Windows Perl interpreters.

Instructions

    • 1

      Find the location where Perl is installed. Linux and Unix systems most frequently use "/usr/bin/perl." Windows systems use "C:\Perl\bin\perl" for Perl installation.

    • 2

      Open Notepad, vi, emacs or your favorite text editor.

    • 3

      Create your first comment line. The hash symbol designates that the line is a comment. Point it to the location where Perl is installed.

      Example: #!/usr/bin/perl

    • 4

      Create a line that tells the interpreter that you are working on the Internet within a Web browser.

      Example: print "content-type: text/html \n\n";

    • 5

      Put all of your code together to create a script that displays "Hello, World!" This is the customary display text for initial or test files in programming, but you may use any phrase you choose.

      Example:

      #!/usr/bin/perl

      print "content-type: text/html \n\n";

      print "Hello, World!";

    • 6

      Save your new Perl script as "helloworld.pl" or something else you can easily remember.

    • 7

      Upload your new "helloworld.pl" file to your Web server. Set your upload type to "ASCII" or "text." CHMOD the file to 0755 after it has been uploaded to allow anonymous execution of your Perl file.

      Your new script can now be accessed and executed in your browser by directly accessing the file at "http://www.MyWebServer.com/helloworld.pl"

Related Searches:
  • Photo Credit Thinkstock/Comstock/Getty Images

Comments

Related Ads

Featured