GCA
GCA Attend a GCA Conference

Dear Intro to Programming Attendee --

Welcome aboard! In order for the tutorial to run smoothly, you should install Perl and ensure that it works prior to the tutorial. (Note that this is not a requirement -- if you don't have a laptop with you you can still learn some programming, but you won't have as much fun, and will not learn as much.)

After installing Perl (or if you already have it installed), you should ensure that it's working properly, and that you know how to run it. I will have a few sample program and data files for to download, too.

Please write to me by mid-week and let me know both what kind of system you're using, and how succesful you have been at getting Perl to run on it.

I am not an expert on installing things in general, let alone Perl, but here are some brief instructions to get you started.

Note that CPAN, a site listed below from which to get Perl, has lots of mirror sites. See http://www.perl.com/CPAN-local/SITES.html.

GNU/Linux

If you have a GNU/Linux system, the odds are reasonably high you already have Perl. Try the command

perl -v

if you get version information that tells you you're running Perl 5.xx (I'm running 5.005_02), you're good to go. If you get a "command not found" error message, you'll need to install Perl. You can install from source, or if you're lucky, there will be a binary available for your system. Both are available from http://www.ActiveState.com/Products/ActivePerl/. You will also need a text editor. I don't know of any GNU/Linux system that does not have either vi or emacs. Both are excellent editors, although I cannot help you with vi at all.

After you've ensured you have Perl, make sure you can get it to work. Obtain or write the hello_world.perl program (found below in this mail). Then try to execute it both from a perl commandline (perl hello_world.perl) and, after setting it to be an executable file (chmod), as a command itself (you may need to change your PATH environment variable or enter the entire path to the perl program).

Macintosh

Two possible setups:

* MPW (Macintosh Programmer's Workshop) and MacPerl for MPW.

* Alpha or BBEdit and MacPerl. (You could use a different text editor, but these are the only two that I know of that will do syntax coloring, run Perl scripts on their buffers, and some other cool things.)

I'm guessing if you use MPW you don't need any instructions from me, except where to get MacPerl -- you'll need both of the following:
http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_appl.bin
http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_tool.bin

Alpha is a $30 shareware text editor that is very powerful, and integrates quite well with MacPerl, but does not have a particularly friendly interface, and occasionally crashes my Mac. It can be obtained from http://alpha.olm.net/. The current released version is 7.2 (click on "downloads"); I use the pre-release 7.3 (link is near the bottom of the page).

BBEdit is a roughly $100 commercial text editor that is very also powerful, and particularly well suited for HTML. It is somewhat more "Mac-like", better documented, and easier to use in general than Alpha, but is not as well integrated with MacPerl. I use 4.5; the MacPerl integration is better (but still not as good as Alpha's) in the current version, 5.1.1.

There is a free version "BBEdit Lite", which integrates as well as 4.5, but does not do syntax coloring, and is missing several other useful features. Both are vailable from http://www.barebones.com/.

Whichever editor you use, you only need to install the MacPerl application (you can get it from http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_appl.bin) One can usually get away with only the default settings. MacPerl knows which editor you are using by the "editor" setting chosen in the "Helpers" panel of Internet Config.

To test that MacPerl works, obtain or write the hello_world.perl program (found below in this mail), and save it as a plain text file. >From within MacPerl press CMD-R (or choose Script > Run Script...), choose the hello_world.perl program you have just saved.

Windows

I do not use PCs myself; I did once help a colleague install Perl (and emacs & bash) on a Windows NT machine, though. For Windows 3.1, 95, 98, 2K, & NT there is a port of Perl available at http://www.ActiveState.com/Products/ActivePerl/.

Supposedly when the Active Perl installer runs it sets your system so that Windows associates the extension ".pl" with the Active Perl application -- but I never got that to work on my colleague's machine.

In order to use redirection (which will be explained during the tutorial) you will have to issue perl commands from a command shell -- DOS and bash are the only two I know of. Bash has loads of advantages like tab completion and command history, but DOS has the advantage of already being on your system (and probably familiarity).

After installing, you should test that Perl works. Obtain or write the hello_world.perl program (found below in this mail). Then try to execute it from a perl commandline in your shell. Probably something like

C:\Applications\Perl\perl.exe C:\Documents\Perl_Tut\hello_world.prl

You could also set your environment so that "perl" could be substituted for the complete path to the perl interpreter itself, and if you made the directory with your programs the current directory (e.g., something like cd c:\Documents\Perl_Tut\), you could skip typing the path to the program file, too. Theorhetically you should be able to convince your system to run the program by entering just "hello_world", but I've yet to get that to work. I do not know how to run Perl on a Windows system other than via a DOS or bash shell. (I don't even know if it can be done.) If anyone figures it out, please let us all know.

--------------- do not include this line in program ---------------

#! put-your-path-to-perl-here -w

#
# hello.perl
#
# Written 2000-07-17 by Syd Bauman as demo of a tiny Perl program.
# Does nothing except write "Hello, world!" to STDOUT.
#

use strict; # forces more explicit code
use English; # allows clearer special variable names

print "Hello, world!\n"; exit 0;

---------- do not include this line in program, either ----------


Replace "put-your-path-to-perl-here" with the path to the Perl interpreter. In GNU/Linux this is likely to be something like "/user/local/bin/perl"; in Windows it might be something like "C:\Applications\ActivePerl\perl.exe" (I'm not sure wether or not you should include the ".exe".) In either case, this line is only used if you try to enter the program as an executable, rather than specifying the program file as an argument to the perl command. On a Mac, the "put-your-path-to-perl-here" is just "perl".

-- Syd Bauman
Syd_Bauman@Brown.edu
401-863-3835


Attend a GCA ConferenceBecome a GCA MemberBuy a GCA Publication
Today's News Digest
What is XML?What is SGML?ICEGCA's Mail.dat
Technical CommitteesTechnical ResourcesTargeted InitiativesGCA's GRACol
What is GCA?GCA Press ReleasesGCA MembersGCA's ICCContact GCA
GCA - Phone: +1 703-519-8160   Click Here For Legal And Technical Information
Click Here For Legal And Technical Information email: info@gca.org