The System Administrator Notebook

Pages in the Perl section

Syntax Notes Perl Oneliners Perl for XML Databases Web Pages OOPerl Moose Modules Mojolicious

Modern Perl

Page Contents

Acknowledgement

Top Bottom

'Modern Perl, 4th Edition', Chromatic, 2015, ISBN 13-978-1680500882, Pragmatic Bookshelf

Modern Perl Template

Top Bottom

First Edition of Perl was released in 1987. Modern Perl is an approach to writing Perl that takes into account lessons learned over the 30 years that Perl has been available.

Modern Perl programs should begin with the following lines:

#!/usr/bin/env perl
use Modern::Perl '2015';
use autodie;

If you do not have Modern::Perl installed, use the following template:

#!/usr/bin/env perl
use 5.016;
use warnings;
use autodie;

For test scripts use:

#!/usr/bin/env perl
use Modern::Perl;
use Test::More;

# Code goes here

done_testing();

Documentation

Top Bottom

Use 'perldoc perltoc' to get a list of the perldoc subject areas. Perldoc comes with a number of useful switches:

-q
To search the FAQs for a keyword
-f
For documentation on a built-in function
-v
For documentation for built-in variables
-l
Shows the path to the file containing the documentation
-m
Displays the entire contents of the module

On-line sources for documentation:

  1. Perldoc
  2. CPAN
  3. METACPAN