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 ...

Get Open Source Web Development with LAMP: Using Linux, Apache, MySQL, Perl, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.