LoginSignup
1
1

More than 5 years have passed since last update.

正しい複数行コメント

Last updated at Posted at 2015-12-17

perl の複数行コメントは、Pod の書式を利用します。

ってんで、

  1. =for comment ... =cut1
  2. =pod ... =cut2
  3. =begin comment ... =end comment\n\n=cut3

の3通り4perldoc で紹介されている訳なんだけど、
perldoc test.pl した時に表われない、3番目を使いましょう。

いや、3番目をいつも使ってたのに、過去のスクリプトで1番目が出て来て混乱したので、、、

ちなみに1番目は、「=for comment 直下の一段落だけ、perldoc がスルーしてくれる」だけなので、使いにくい。
汚なかろーが、3番目が一番確実に無視してくれる。

test.pl
=head1 test.pl

=encoding utf8

test.pl - pod 表示のテスト

=cut

print "code\n" ;

=for comment
こっからコメントしてる訳
なんだけど、

ここから現われる。

=cut

print "code\n" ;

=begin comment

ぜーんぶ

無視

して

くれる。

=end comment

=cut

print "code\n" ;

__END__
$ perldoc test.pl
test.pl
    test.pl - pod 表示のテスト

    ここから現われる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1