To clarify: as of writing, on Perl 5.28.1 and Perldoc v3.2801:
- =for comment hides text from perl but not perldoc
- =begin comment hides text from both perl and perldoc
For example, given foo.pl as follows:
Comment! Number 2
- perl foo.pl produces empty output and no errors
- perldoc foo.pl produces:
which is the text from the =for comment / =cut block.
Therefore, I personally use =begin comment / =end comment / =cut
, even though it's a bit tedious.