Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Multi-line comments in perl code?

by McDarren (Abbot)
on Jul 13, 2006 at 12:42 UTC ( #560929=note: print w/replies, xml ) Need Help??

in reply to Multi-line comments in perl code?

There is no "official" way to comment out large chunks of code in Perl, although there are plenty of workarounds. Generally, it depends on which editor you are using. Any decent editor will allow you to define a macro or hotkey for this purpose.

One method that some people use is to make use of pod-style =pod and =cut.

Darren :)

Replies are listed 'Best First'.
Re^2: Multi-line comments in perl code?
by mrguy123 (Hermit) on Jul 13, 2006 at 12:58 UTC
    Thanks Darren.
    I understand that perlpod is a very powerful tool for documenting a program so that you can create a html documentation page. It is a very good way to write comments before the function begins. I was wondering if there was a different way to write long comments inside functions with out using =pod and =cut, and obviously without starting each new sentence with a "#".
    Thanks again,

      I assume that you're worried that "pod comments" will appear in the output from any POD processing that you do on the file. The way round that is to use the =begin and =end directives. Any section that is marked as =begin comment will only be picked up by a POD processor that is specifically looking for content marked as a comment. No such processors (currently) exist, so your comments wouldn't suddenly start appearing in your documentation.

      See perlpod for details.


      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

      Okay, well again the answer is "No, not really"
      But that doesn't mean you can't automate the task. For example, if you happen to be using Vim as your editor-of-choice, then there is a very useful BlockComment plugin available, which makes this task very easy.

      Darren :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-08-13 22:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found