Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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.

Cheers,
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,
    Guy

      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.

      --
      <http://dave.org.uk>

      "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.

      Cheers,
      Darren :)

Log In?
Username:
Password:

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

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










    Results (76 votes). Check out past polls.

    Notices?