Hello Monks,
I was finding ways to use multi line comments (v5.22.0) and found perlfaq7 section "How can I comment out a large block of Perl code?" The two ways suggested there are:
And=pod . . =cut
=begin comment . . . =end comment =cut
But when I was playing with it I noticed that using pairs of "=cut" also does the same without any warning/error, with use strict and warnings.
=cut . . . =cut
But I am not sure if it's safe or recommended as perlpodspec section "=cut" says that:
It is an error to try to start a Pod block with a "=cut" command. In that case, the Pod processor must halt parsing of the input file, and must by default emit a warning.Also Excess =cut breaks module has some views against using pair of =cut for multi line commenting.
So I was hoping to get some views on if it's recommended or safe to use pairs of "=cut" for multi line commenting in production code? I felt pairs of "=cut" is easier to remember than "=pod" or "=begin/end comment".
I am using following simple test code for trying this out:
#!/opt/apps/perl/perl5220/bin/perl use strict; use warnings; print "Line1\n"; print "Line2\n"; =cut print "Line3\n"; =cut print "Line4\n"; =cut print "Line5\n"; =cut print "Line6\n";
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |