What are the common workarounds for multi-line comments in Perl?

Viewed 10114

This RFC mentions

Unlike many programming languages Perl does not currently implement true multiline comments. This, and the workarounds that are in common use can be problematic. This could be solved by adding a new syntax to allow for comments to span more than one line, like the variation on here-documentation cited below.

What are the common workarounds?

Two techniques I found here are

if (0) {
  <comment>
}

and

=pod
<comment>
=cut

Are these safe to use? Are there others that work better?

13 Answers

This even simpler construct worked for me

=comment

It was hard in the Moonta Mines that year
For the miners, down in the pit,
It wasn’t a place for a weak man, but
The Cornish Miners had grit,
They burrowed deeper with every day
Extracting the copper ore,
And the skimps grew high in the heaps that piled
Not far from the Moonta shore.

=cut
Related