Perl Programming   «Prev  Next»

Perl TestBed - Exercise

Create your own test bed using Perl

Objective:Create a test bed you can use throughout this course.

Perl test bed Instructions

  1. Create a directory called perlwork (or something similar).
  2. Create a file called test.pl
    (or something similar) in your new directory.
  3. Cut and paste the program below into your testing file and run it.
    This is a simple perl program to get input from the user and print it.
The purpose of creating a Perl testbed after you have installed Perl, is so that you have a working environment from which you can 1) develop and 2) test your Perl programs.

Create TestBed

Copy and paste the following code into your favorite editor and then run it from the command line.

#!/usr/bin/perl -w

print "prompt: ";
$line = <>;
print "The input is: $line";

Continue with the next lesson after you have successfully ran the program from the command line.
If you are having problems getting the program to run, download the executable for win32 at ActiveState.
This will install everything you need to run Perl from the DOS prompt.