2. Hello, World

The program in the preceding step, as you saw, didn't do anything, unless you mistyped something and got an error message. The goal here is to get Perl to give a minimal response so that you know it is alive. You'll do this with a print statement.

The print statement begins with the keyword, print, followed by what is to be printed, followed by the required semicolon.

What is printed will usually be placed within double quote marks (""); yes, Perl makes a distinction between single quotes ('') and double quotes (""), which will be explained in the Perl Basics discussion). It may also be placed within parentheses, but they are not required.

If you would like for the output to be placed on a line by itself, print \n at the end of the line.

Hello, World program

#!/usr/local/bin/perl
print "Hello, World!\n";

Type it in and run it.