Table of Contents

Your First Time

Assuming all has gone to plan, you can now create your first Perl script. Follow these instructions, but before you start read them through once, then begin. That's a good idea with any form of computer-related procedure. So, to begin:

  1. Create a new directory for your perl scripts, separate to your data files and the perl installation. For example, c:\scripts\, which is what I'll assume you are using in this tutorial.
  2. Start up whatever text editor you're going to hack Perl with. Notepad.Exe is just fine. If you can't find Notepad on your Start menu, press the Start button, then select Run, type in 'notepad' and click OK.
  3. Type the following in Notepad
    print "My first Perl script\n";     
  4. Save the to c:\scripts\myfirst.pl. Be careful! Notepad will may save files with a .txt extension, so you will end up with myfirst.txt.pl by default. Perl won't mind, it'll still execute the file. If your version of Notepad does this, select "All files" before saving or rename the file then load it again. Better yet, use a decent text editor!
  5. You don't need to exit Notepad -- keep it open, as we'll be making changes very soon.
  6. Switch to your command prompt. If you don't know how to start a command prompt, click 'Start' and then 'Run'. If using Windows 9x, type in 'command' and press enter. If using NT, type in 'cmd' and press Enter.
  7. Change to your perl scripts directory, for example cd \scripts .
  8. Hold your breath, and execute the script: perl myfirst.pl

and you'll see the output. Welcome to the world of Perl ! See what I mean about it being easy to start ? However, it is difficult to finish with Perl once you begin :-)