http://qs321.pair.com?node_id=560929


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 :)