Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

perl

What are plain old text comments in Perl 5.34?

Sheza Munir

Perl supports a language named plain old text (POD). POD is a markup language we can use to write descriptive comments in Perl. We can embed any type of file within POD. Perl skips over the POD text when parsing the file for execution.

Syntax

The syntax for POD comments is displayed below:

=head1 Syntax example 
Write comments here.
=cut

Types of paragraphs in POD

There are three types of paragraphs in POD:

  1. Verbatim paragraphs:
    We use verbatim paragraphs for text that does not need special formatting. This includes literal text that we want to appear as written, such as snippets of code. The text must be indented and must not have any styling. Keywords also appear as plain literals.

  2. Ordinary paragraphs:
    We can use the usual formatting codes here to bold, italicize, or otherwise format the text. We may use special sequences to adjust the formatting here. Some examples are shown below:

Formatting

Description

I<text>

The text between '<' and '>' is italicized.

B<text>

The text between '<' and '>' is boldened.

C<text>

The text between '<' and '>' is formatted as a code snippet.

S<text>

The text between '<' and '>' is formatted text with nonbreaking spaces.

  • Command paragraphs:
    We use command paragraphs for special treatment for the whole text using commands. Examples of supported commands include:
=pod
=head1 Heading Text
=head2 Heading Text
=head3 Heading Text
=head4 Heading Text
=over indentlevel
=item stuff
=back
=begin format
=end format
=for format text...
=encoding type
=cut

RELATED TAGS

perl

CONTRIBUTOR

Sheza Munir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring