Probably a stupid question but....

Discussion in 'Perl Misc' started by Bill H, Oct 1, 2008.

  1. Bill H

    Bill H Guest

    In all the years I have been working in perl (and I do not call myself
    an expert by any means), I have never come across a way of having
    multi-line comments. In PHP, C, Actionscript you have the /* && */ to
    mark a block, is there one in perl? Only reason I have decided to ask
    now, I just commented out 50 plus lines of code using # enter arrow
    left repeat and I know (or hope) there has to be a much simpler way
    of doing it.

    Bill H
     
    Bill H, Oct 1, 2008
    #1
    1. Advertising

  2. Bill H <> wrote:
    > In all the years I have been working in perl (and I do not call myself
    > an expert by any means), I have never come across a way of having
    > multi-line comments. In PHP, C, Actionscript you have the /* && */ to
    > mark a block, is there one in perl? Only reason I have decided to ask
    > now, I just commented out 50 plus lines of code using # enter arrow
    > left repeat and I know (or hope) there has to be a much simpler way
    > of doing it.
    >
    > Bill H


    http://perldoc.perl.org/perlpod.html

    --
    [pl>en Andrew] Andrzej Adam Filip : :
    Anger is momentary madness.
    -- Horace
     
    Andrzej Adam Filip, Oct 1, 2008
    #2
    1. Advertising

  3. Bill H

    Tim Greer Guest

    Bill H wrote:

    > In all the years I have been working in perl (and I do not call myself
    > an expert by any means), I have never come across a way of having
    > multi-line comments. In PHP, C, Actionscript you have the /* && */ to
    > mark a block, is there one in perl? Only reason I have decided to ask
    > now, I just commented out 50 plus lines of code using # enter arrow
    > left repeat and I know (or hope) there has to be a much simpler way
    > of doing it.
    >
    > Bill H


    I usually just have a block of text or code I don't want to run, and I
    do a:

    =junkstuff
    block
    of
    text
    etc
    here
    =cut


    If the code you want to not run is after all the code you want to use,
    you can use __END__ or something else, depending on the formatting, if
    you need code below it, etc.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
     
    Tim Greer, Oct 1, 2008
    #3
  4. Bill H

    Ben Morrow Guest

    Quoth Bill H <>:
    > In all the years I have been working in perl (and I do not call myself
    > an expert by any means), I have never come across a way of having
    > multi-line comments. In PHP, C, Actionscript you have the /* && */ to
    > mark a block, is there one in perl?


    perldoc -q comment

    > Only reason I have decided to ask
    > now, I just commented out 50 plus lines of code using # enter arrow
    > left repeat and I know (or hope) there has to be a much simpler way
    > of doing it.


    Get a decent editor? V <select code> :s/^/# works fine for me... :)

    Ben

    --
    #!/bin/sh
    quine="echo 'eval \$quine' >> \$0; echo quined"
    eval $quine
    # []
     
    Ben Morrow, Oct 1, 2008
    #4
  5. Bill H

    Dr.Ruud Guest

    Bill H schreef:

    > In all the years I have been working in perl (and I do not call myself
    > an expert by any means), I have never come across a way of having
    > multi-line comments.


    There are many ways. You can put an if(0) block around code.

    $ perl -MO=Deparse -e'
    my $x = 1;
    my $y = 2;
    my $z = 3;
    '
    my $x = 1;
    my $y = 2;
    my $z = 3;
    -e syntax OK



    $ perl -MO=Deparse -e'
    my $x = 1;
    if (0) {
    my $y = 2;
    }
    my $z = 3;
    '
    my $x = 1;
    '???';
    my $z = 3;
    -e syntax OK



    Or use a heredoc, if it is about textual comment.

    $ perl -MO=Deparse -Mstrict -Mwarnings -e'

    0 if !<<" */";
    /*
    * blabla
    *
    */

    exit;
    '
    use warnings;
    use strict 'refs';
    '???';
    exit;
    -e syntax OK


    Or use pod.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, Oct 3, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Materialised

    Probably a Stupid Mistake

    Materialised, Oct 22, 2004, in forum: C++
    Replies:
    6
    Views:
    490
    Ben Measures
    Oct 22, 2004
  2. Mark Healey

    Probably a stupid newbie question.

    Mark Healey, Feb 7, 2004, in forum: C Programming
    Replies:
    2
    Views:
    318
    Dan Pop
    Feb 10, 2004
  3. hawkmoon269
    Replies:
    5
    Views:
    311
    Nick Craig-Wood
    Feb 10, 2005
  4. Stef Mientki
    Replies:
    1
    Views:
    595
    Carl Banks
    Dec 30, 2006
  5. tsuraan
    Replies:
    0
    Views:
    93
    tsuraan
    Aug 26, 2005
Loading...

Share This Page