next up previous contents
Next: Command Line Flags Up: Introduction Previous: How is perl different   Contents

Invoking perl

There are several different ways of invoking perl. The simplest is to create a perl program (sometimes refered to as a perl script) with your favorite text editor, and then to invoke perl on that program. Under UNIX, the most common way to run perl is to use a special feature of the shell, which allows you to specify the program which should be used to interpret the file's contents on the first line of your program. Assuming the perl executable on your system is stored in the file /usr/local/bin/perl, you can put a line like this
     #!/usr/local/bin/perl
at the top of your perl script, mark the script as executable with the UNIX chmod command, and execute the perl program by simply typing its name at a UNIX prompt.

An alternative is to type perl at the command line, enter your perl statements, and finally type __END__ alone on a line, to signal to perl that it should execute the statements you've entered.



Subsections

Phil Spector 2002-10-18