O'Reilly logo

Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP by Brent Ware, James Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.3. Perl Syntax Rules

First, the basic Perl syntax rules. Hang in there; although there are a plethora of hello, world’s here, the somewhat unnerving friendliness and patience engendered by repeating this mantra will serve you well later when things get more involved.

4.3.1. A First Perl Program—hello, world

As always, the best way to learn is by doing. For example, here is the ever popular print hello, world program:

#! /usr/bin/perl -w 
# file: hello.pl 

print "hello, world!\n"; 

The first line is a shell directive (also known as the hash/bang or shebang). This line informs the shell that this script uses /usr/bin/perl. Your distribution might have it in a different place, /usr/local/bin/perl, for example. [3] The -w switch causes Perl to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required