Presenting Mathematical Concepts on the World Wide Web
Forms & Scripts
Perl: Basics
A Perl program is an ASCII text file. To run it, you load it into the
Perl interpreter. Thus if your program were name "testprog" you would
run it via the command perl testprog
.
Under Unix, you can can have this happen
automatically by making
#!/usr/local/bin/perl
the first line of your program, and changing the attributes the
program file to include 'executable'.
Thus, a typical 'hello world' program looks like:
#!/usr/local/bin/perl
print "hello world \n";
Things to note:
- Perl statments all terminate with a ;
- You have to explicitly tell
print
to print the
linefeed "\n"
Next: Variables
Back: CGI Scripts with Perl
Up:
Forms & Scripts
Presenting Mathematical Concepts on the World Wide Web.
Copyright © 1997 by
Carol Scheftic.
All rights reserved.
(This section was originally copyrighted in 1996 by
The Geometry Center
and is re-used here with permission.)
Please send comments on this page,
or requests for permission to re-use material from this page, to:
scheftic@geom.umn.edu
Page established 1-Jun-97;
last updated Thursday, 24-Jul-1997 01:16:23 CDT.