Starting Perl
homencsa resources partnershipsoutreachsoftware_tech
alliance searchinside ncsa adv_computingsciencedivisions
left up right comment

Starting Perl

Typically, perl is used to interpret a script. You can run a script explicitly with perl (the % is your command prompt)
 
	% perl scriptname 
or
 
	% cat scriptname | perl 
That isn't convenient enough, since you'd rather not have to distinguish what is a real compiled program and what is a script. Therefore, UNIX shells have a shortcut. If a text file is executable, and the first line is of the form
 
	#!program [optional program arguments] 
the shell executes
 
	program [optional program arguments] scriptname 
Note: While there is some leading whitespace to offset the code examples, all examples should not use the first <tab> - especially this example of the shell shortcut.

Example

To start off our program, edit the file mailform, add the first line:
 
	#!/usr/local/bin/perl 
(or whatever the location of your perl binary is), save, exit the editor, and make the program executable:
 
	% chmod +x mailform 

left up right comment



NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

johnsonb@ncsa.uiuc.edu

Last modified: June 19, 1997



Retrieved by Memoweb from http://www.ncsa.uiuc.edu/General/Training/PerlIntro/startup.html at 08/02/99