There are probably three approaches to multiline comments that I can think of at the moment.
using POD
This one is part of the Perl language itself. it is fully documented in perlpod manual. You would do it like this:
.... some code ....
=pod
multiline comment
(or just code that you don't want to be executed)
=cut
...some more code...
Working around with if (0) {...}
This is juat a workaround, where you place the code in a if block that is never executed (you can't put just any text there, because it is Perl code after all). However, you specifically asked for commenting out of Perl code, so this might be applicable to you
...some code...
if (0) {
...some code commented out...
}
...some more code...
use ACME::Comment
There is a module ACME::Comment that let's you use any kind of commenting style you want. This example is taken straight from it's documentation:
use Acme::Comment type=>'C++', own_line=>1;
/*
if (ref $mod) {
$bar->{do}->blat(msg => 'blarg');
eval {
i'm sooo sick of this time for some coffee
*/
// I prefer beer. --sqrn
Hope this helps.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|