Skip to Main Content
Perl Pocket Reference, 5th Edition
book

Perl Pocket Reference, 5th Edition

by Johan Vromans
July 2011
Intermediate to advanced content levelIntermediate to advanced
104 pages
2h 14m
English
O'Reilly Media, Inc.
Content preview from Perl Pocket Reference, 5th Edition

Syntax

Perl is a free-format programming language. This means that in general it does not matter how a Perl program is written with regard to indentation and lines.

An exception is when Perl encounters a sharp or pound symbol (#) in the input: it then discards this symbol and everything following it up to the end of the current input line. This can be used to put comments in Perl programs. Real programmers put lots of useful comments in their programs.

There are places where whitespace does matter: within literal text, patterns, and formats.

If the Perl compiler encounters the special token __DATA__, it discards this symbol and stops reading input. Anything following this token is ignored by the compiler, but can be read by the program when it is run, using the package filehandle DATA.

__END__ behaves like __DATA__ in the top level script (but not in files loaded with require or do) and leaves the remaining contents of the file accessible via the global filehandle DATA.

When Perl is expecting a new statement and encounters a line that starts with =, it skips all input up to and including a line that starts with =cut. This is used to embed documentation.

perlsyn.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 9781449311186Errata Page