Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Commenting out script in Perl like in C++

by moxliukas (Curate)
on Jul 26, 2003 at 10:15 UTC ( #278077=note: print w/ replies, xml ) Need Help??


in reply to Commenting out script in Perl like in C++

There are probably three approaches to multiline comments that I can think of at the moment.

  • using POD

    This one is part of the Perl language itself. it is fully documented in perlpod manual. You would do it like this:

    .... some code .... =pod multiline comment (or just code that you don't want to be executed) =cut ...some more code...
  • Working around with if (0) {...}

    This is juat a workaround, where you place the code in a if block that is never executed (you can't put just any text there, because it is Perl code after all). However, you specifically asked for commenting out of Perl code, so this might be applicable to you

    ...some code... if (0) { ...some code commented out... } ...some more code...
  • use ACME::Comment

    There is a module ACME::Comment that let's you use any kind of commenting style you want. This example is taken straight from it's documentation:

    use Acme::Comment type=>'C++', own_line=>1; /* if (ref $mod) { $bar->{do}->blat(msg => 'blarg'); eval { i'm sooo sick of this time for some coffee */ // I prefer beer. --sqrn

Hope this helps.


Comment on Re: Commenting out script in Perl like in C++
Select or Download Code
Re: Commenting out script in Perl like in C++
by Abigail-II (Bishop) on Jul 26, 2003 at 16:28 UTC
    If you use if (0), there are a few things you should be aware of. First, the code is still complied - so your outcommented code should be valid, otherwise your program won't compile. Second, things that have a compile time effect still happen. This includes, but is not limit to, use, BEGIN, our and subroutine declaration.

    Abigail

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2014-09-17 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls