develooper Front page | perl.beginners | Postings from May 2008

Re: Multiline comment in Perl

Thread Previous | Thread Next
From:
Octavian Rasnita
Date:
May 16, 2008 03:08
Subject:
Re: Multiline comment in Perl
Hi,

Perl doesn't have a multiline comment mark.

You can use perldoc marks in order to comment what you want, or include the 
content in a string, like:

Perldoc style:

=start
Here
are the
lines you
want to comment
=cut

Or using a string:

q/
Here are
the
lines you
want to comment
/;

The program will work fine, but in the second example, if you use

use warnings;

it will tell you that you used this string in a void context.
If you don't like the warning, you could use:

my $zzz = q/
...
/;

The first way is prefered, but the second way allows you to comment one line 
or more lines using the same syntax.

Octavian

----- Original Message ----- 
From: "sivasakthi" <msivasakthi@gmail.com>
To: "beginners perl" <beginners@perl.org>
Sent: Friday, May 16, 2008 12:24 PM
Subject: Multiline comment in Perl


> Hi all,
>
>
> How to comment Multiple lines  in Perl?
>
>
>
> Thanks,
> Siva
>
>
> 


Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About