Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Multi-line comments in perl code?

by CountZero (Bishop)
on Jul 13, 2006 at 19:31 UTC ( #561052=note: print w/replies, xml ) Need Help??


in reply to Multi-line comments in perl code?

TIMTOWTDI!
$comment = <<'EOC' This is a multiline comment. You can even indent it! Look And come back To the margin. EOC
Of course the word comment is used here in its widest sense.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: Multi-line comments in perl code?
by pKai (Priest) on Jul 13, 2006 at 20:42 UTC

    Such an assignment has to end somewhere (semicolon, block end, EOF) to be syntactically correct.

    For sake of simplicity, assuming it is really just a comment (as opposed to production data), right on the same line, as in

    $comment = <<'EOC'; bla bla EOC

    And while you are on it you can even give perl a hint that it can forget about that content as soon as possible:

    $comment = <<'EOC' if 0;

    Of course, whether you should resort to such "comments" is a completely different question.

Re^2: Multi-line comments in perl code?
by ikegami (Pope) on Jul 14, 2006 at 19:08 UTC

    Your solution

    • is not strict-safe, but that can be fixed with a my
    • is not optimized away,
    • doesn't have indentable directives.

    The following doesn't suffer from those limitations:

    0 && q{ ... };
    0 && comment && q{ ... };
    use constant _comment_ => 0; _comment_ && q{ ... };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-08-14 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (76 votes). Check out past polls.

    Notices?