Getting Started with Perl

Table of Contents

Install Perl

You need to install Perl \(\geq\) 5.10 on your machine.

For OS X and Linux, Perl is already installed. Head to the next section.

For Windows, you can install one of these free packages:

Running Perl

Type perl -v on your computer to ensure it works.


  1. Hit Cmd+SPC and enter "Terminal" in Spotlight, or open Applications/Utilities/Terminal.app
  2. Enter perl -v and press RET



  1. If you installed the portable edition, navigate to the extracted folder and double-click portableshell.bat (if you installed the full edition, find portableshell in your Start menu)
  2. Enter perl -v and press ENTER



  1. Open your terminal (i.e., xterm, terminator, GNOME Terminal, etc.)
  2. Enter perl -v and press RET

Setup your text editor

You need a plain-text editor to edit Perl files. Microsoft Word, Apple Pages, or TextEdit will not work. Here are some suggestions, but feel free to use other text editors (Google "free text editor +Windows")

SciTE, Notepad++, GNU Emacs
TextWrangler, Tincta, Aquamacs
Kate (KDE), gEdit (GNOME), GNU Emacs

Create your first program

  1. In your new text editor, create a new file called hello.pl
  2. Paste the following contents in: print "Hello, World!\n";
  3. Save the file to your desktop
  4. Open your terminal/shell and change to the folder containing your script. Use the cd ("change directory") command for this:
    OS X and Linux
    cd ~/Desktop
    cd %UserProfile%\Desktop
  5. Run the script: perl hello.pl


Date: 2011-11-13 15:29:58 MST

Author: Jon-Michael Deldin

Org version 7.7 with Emacs version 23