Probably a stupid question but....

B

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? 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
 
A

Andrzej Adam Filip

Bill H said:
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
 
T

Tim Greer

Bill said:
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.
 
B

Ben Morrow

Quoth Bill H said:
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
 
D

Dr.Ruud

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top