PERL: the end of the first rainbow (for Windows users)

Summer tutoring continues.  Today, the tutor hopes, we get word back from PERL.

In the previous article I brought the Linux and (hopefully) Mac users on board with creating a text file, then finding it in the terminal. Earlier, I described how to do it under Windows. Now, I imagine, “everyone” knows how to, on their home system, create a text file, then find it in the terminal.

The goal of today’s article is to create a PERL script, find it in the terminal, and run it. Once again, there is a dichotomy between Windows and Linux/Mac.  This article will cover Windows; the next one, Linux/Mac.

Windows users:

In Notepad, open a new text file, then type the following:

print “Hello from PERL on Jun30, 2014!\n\n”;

Save the file. Let’s imagine you call it  myfirstperl  then save it to your folder (aka directory) “my perl programs” (or whatever you called the folder). Now, follow these steps:

  1. Open the terminal and go into the directory “my perl programs” (or, once again, whatever you happened to call it).
  2. Enter the command  dir to confirm your file  myfirstperl is indeed in the directory. If you called it  myfirstperl, it should show up as myfirstperl.txt
  3. Let’s assume you see your file myfirstperl.txt. Now, key in

    perl myfirstperl.txt

If it worked, the terminal should reply with

Hello from PERL on Jun30,2014!

Hopefully, the procedure worked for you.  If so, you have successfully begun programming with PERL:  congratulations!

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Leave a Reply