< BACKCONTINUE >

B.1 Command Interpretation

The Perl programs in this book start with the line:

#!/usr/bin/perl -w

On Unix (or Linux) systems, the first line of a file can include the name of a program and some flags, which are optional. The line must start with #!, followed by the full pathname of the program (in our case, the Perl interpreter), followed optionally by a single group of one or more flags.

If the Perl program file was called myprogram, and had executable permissions, you can type myprogram (or possibly ./myprogram, or the full or relative pathname for the program) to start the program running.

The Unix operating system starts the program specified in the command interpretation line and gives it as input the rest of the file after the first line. So, in this case, it starts the Perl interpreter and gives it the program in the file to run.

This is just a shortcut for typing:

/usr/bin/perl -w myprogram 

at the command line.

< BACKCONTINUE >

Index terms contained in this section

! (bang)
      #! (shebang) notation
# (sharp)
      #! (shebang notation), command interpretation line
commands
      interpretation line
Perl
      command interpretation

© 2002, O'Reilly & Associates, Inc.