Writing and running scripts

Before starting to write code, let's review some of the tools we'll be using.

Text editor

Even though you can use any text editor to create PHP scripts (but never, ever use a word processor), in this course we'll be using Notepad++, a free text editor for Windows that is highly configurable.

Like many programming-oriented text editors, Notepad++ adds color to your code to distinguish between comments, variables, and functions. This color is pure eye candy and has nothing whatsoever to do with how your Perl script runs. You can even turn it off if you want.

Running scripts on a Windows command prompt

In this course we are using Perl on Windows XP. To run a script, in a Windows command prompt run

perl script.pl

as in the following example:

The Windows command prompt

If your script produces output to STDOUT, you will see the output in the command prompt. If your script writes to a file, you will have to open the file in your text editor to see the output.

Some basic but useful DOS commands

During this course you will find yourself copying files frequently, usually so you can modify the copy slightly for some purpose. You are free to use Windows Explorer for these activities but you might find using command-line utilities faster since you will be using the command line to run scripts:

Command Example
dir dir
copy copy file1.txt file2.txt
del del file2.txt