Team LiB   Previous Section   Next Section

Running Perl Scripts

You can run your Perl scripts in several ways on Unix. For example, you can invoke the perl program directly on the command line as follows:

$ perl my_unix_perl_script.pl

Alternatively, make your script executable and then install a full path call to your chosen version of Perl on the first line of your script. This is done using the shebang #! syntax familiar to shell programmers:

#!/usr/local/bin/perl
  
use warnings;
use strict;
  
# Rest of my script ....

You can now run the program directly:

$ chmod +x my_unix_perl_script.pl
$ ./my_unix_perl_script.pl

On most Win32 systems, the .pl suffix is usually associated with the Perl interpreter; it should work correctly if you double-click on your script or if you call it directly. Alternatively just call perl directly again and specify the script name:

C:\> perl my_win32_perl_script.pl
    Team LiB   Previous Section   Next Section