Basic Syntax
Basic Syntax
Here's some information that applies to all of perl.
- Perl is free form - whitespace doesn't matter. Most people like to
use liberal indentation, but you could write all on one line, if you're
a masochist.
- All perl statements end in a ; (semicolon), like C.
- Comments
- begin with # (pound sign)
- everything after the #, and up to the end of the line is ignored.
- the # needn't be at the beginning of the line.
- There is no way to comment out blocks of code other than putting a
#
at the beginning of each line. It's a convention
taken from the shell utilities, sorry C folks.
Example
Now our program looks like this:
#!/usr/local/bin/perl
# mailform - a simple CGI program to email the contents of an HTML
# form to a specified user.
#
# Ben Johnson
# johnsonb@ncsa.uiuc.edu
# September, 1995
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/syntax.html at 08/02/99