Perl Information Center Tutorials
These tutorials were written to help you get a quick, but thorough, understanding of Perl -
the scope of the language as well as it's specific capabilities.
| Beginners
| Built-In Functions
| Advanced
| CGI Applications
|
|
|
|
|
|
Introduction
As a simple introduction to Perl, I've included the following example along
with instructions on how to run it on your PC or on a remote web server.
The tutorials listed above go into far more detail.
A Simple Program
Just to get you started, here's a quick look at a traditional "Hello World" program.
#!/usr/bin/perl # this line required in Unix, optional on PCs
$name="Hello World"; # assigns a string value to the variable $name
print $name; # prints the variable $name to the screen
Executing a Perl Script Locally
To run the script on a local PC just save it to a file, such as "myscript.pl",
then type in:
perl myscript.pl # explicitly uses the compiler "perl.exe"
or
myscript.pl # Perl installation set PATH to point to perl.exe
Any filename can be used but .pl and .cgi are commonly used extensions.
Executing a Perl Script Remotely
A Perl script can be run on a local PC, just like any other program, but
Perl is most often used on web servers - placed on the server for users
to execute via web page interfaces. The two basic ways to use a web page
to execute a Perl script on a server are hyperlinks and forms.
In both cases, once the script is executed on the server, the output of
the script (typically a web page generated on the fly) is returned to the
calling browser.
If you have any suggestions for additions to these tutorials, please let me know.
|