From the course: Perl 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Anatomy of a Perl script

Anatomy of a Perl script - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Anatomy of a Perl script

- In this lesson, we'll take a look at the parts of a common Perl script. Here's a working copy of Hello.pl from Chapter 3 of the exercise files. This is a very simple Perl script. I'm gonna go ahead and run it and you can see the output down there. It says "Hello, World!" It's not the simplest Perl script you can write, but it probably is the simplest Perl script that you should write. Let's take a look at what's here and why. Here on the first line, this is called the "Shebang Line." It is named for the fact that the exclamation mark is often called a bang and the line itself is read from the invoking shell. So, "shell-bang" or "shebang." Perl was substantially inspired by Unix shell scripting and the shebang line is an old, Unix shell scripting tradition. When a Unix shell, such as bash or born, loads a script, it looks first at the first two bytes to see what type of file it is. If it sees these two characters in the position of the first two bytes, the hash mark and the bang…

Contents