Starting a Perl Script

Upon startup, perl looks for your script in one of the following places:
  1. Specified line by line via -e switches on the command line.
  2. Contained in the file specified by the first filename on the command line. (Note that systems supporting the #! notation invoke interpreters this way.)
  3. Passed in implicitly via standard input. This only works if there are no filename arguments -- to pass arguments to a stdin script you must explicitly specify a - for the script name.

After locating your script, perl compiles it to an internal form. If the script is syntactically correct, it is executed.