Programming with PERL: the terminal, continued

A summer tutoring project is under way; the tutor continues with its next installment.

As I mentioned in my previous article, developing familiarity with the terminal is key to running a PERL program. What the user really need be able to do is create a plain text file, then find it in the terminal environment.

On Windows, suppose you open Notepad and write a line or two. For now, maybe you just write a grocery list.

Windows has the directory “My Documents” or something similar (In Windows 7, it might just be “Documents”.) You might make a new folder in that directory called “my perl programs” or something like that. Next, you might save your grocery list file in there. Maybe you call it groclist.txt, for instance.

Now, you need to be able to find that file in the terminal. Under
All Programs→Accessories, you find Command Prompt, which is the terminal. When you click Command Prompt, a black window opens on the screen. There is the command line: a directory name in white print, with a blinking cursor.

In my experience, the terminal opens to the directory that contains My Documents. Therefore, if you key in

cd my documents

then press Enter, you should arrive there. If so, you’ll see “My Documents” tacked onto the end of the directory name. Windows 7 users might do the step above substituting documents instead of my documents.

If you made a new folder called “my perl programs” in “My Documents”, you’ll be able to find it now by typing in


then pressing Enter. Your folder should appear in the list.

To move into that folder, enter the command

cd my perl programs

Now, “my perl programs” should be tacked on the end of your present location. If you enter the command


you should see your file “groclist.txt” – or whatever you called it – listed.

The above instructions likely give you the tools to create a text file, then find it in the terminal. Such facility is key to creating and running a PERL script.

I apologize that this article covers Windows only. However, an article that covers the other operating systems as well would be too long for our easy summer pace. In the next article I’ll cover the Linux context. I’ll even try to extend to the Mac, though I don’t have one.

A Linux or Mac user who is unfamiliar with the terminal will still pick up valuable hints from this article. The reverse will be true as well: the Windows user will gain from reading the next article, even though its context will be Linux.

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

Leave a Reply