Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to multi line comment? 1

Status
Not open for further replies.

Kero

MIS
Nov 3, 2001
9
0
0
US
Dear sir,

I'm new perl programmer. So I can't multi line comment in my program. I must use "#" each line. How can I do?
And if I want to know length of array. Example I have data in "@testArray". How can I get length of array?

Thanks for your help,
Kero
 
Perl doesn't support multiline comments. You can use the follwing code:
Code:
if (0) {
  ... my code
}

The last element of an array is returned by
$#testArray.

$len = $#testArray + 1;

Thomas
 
It's the best tips for me.
Thanks a lot Thomas. :-D

Kero
 
Actually, perl does support multiline comments. See the perlpod (Plain Old Documentation) manual pages for more information. An example:
Code:
print "hello ";

=pod

This is a comment
And so is this

=cut

print "there\n";
Cheers, Neil
 
You can also get the length of an array by using the arrayname in a scalar context:
Code:
$len = scalar(@array);
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Also, To (mis?) quote Larry Wall, "If your editor can't put a column of sharps on the left margin, then you need real editor." (or words to that effect)

In other words, it's easy if you have an editor that lets you work in column mode; just drag a line down the left side, and hit the # key once.
 
My editor (EditPlus) has a command that allows you to highlight a group of lines and prefix them all with one or more comment characters. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Rycamor,
vi qualifies as a real editor then - with a little effort ;-)
Neil
 
vi is a real editor for real programmers :p Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top