omor.com -> perl -> Comment out a Block of perl Code

Comment Out a Block of perl Code

Using pod is best.

=pod
These are
the lines
to be
commented
out
=cut

Null loops or unreached subroutines also work.

1 while not <<'THISWILLNOTBECOMPILED';
[Code to comment out here...]
THISWILLNOTBECOMPILED

Or maybe just:

if (0) {
[Code to comment out here...]
}

The disadvantage of that syntax is that this only works if what you are
commenting out is syntactically correct. If there's a stray '}' in it, for
example, it'll fail; the here-doc is less susceptible (unless you like
THISWILLNOTBECOMPILED as file handles, for example).

perl at omor.com


Wednesday May 31 09:46 PM EDT