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

Re: Multiline comment in Perl

Thread Previous | Thread Next
From:
Aruna Goke
Date:
May 19, 2008 08:32
Subject:
Re: Multiline comment in Perl
Octavian Rasnita wrote:
> From: "Rob Dixon" <rob.dixon@gmx.com>
>> The documentation that John referred you to recommends
>>
>>  =begin comment
>>    :
>>  =end
>>
>> Which may be a trifle awkward, but I'm sure there are worse things 
>> that happen
>> to you in your day. It takes less than a second to type, and if you do 
>> it a lot
>> you could set up a macro in your editor.
> 
> Unfortunately it doesn't work that way.
> Even the POD documentation says that in the same perldoc -q ...:
> 
> """
>    The pod directives cannot go just anywhere. You must put a pod directive
>    where the parser is expecting a new statement, not just in the middle of
>    an expression or some other arbitrary grammar production.
> """
> 
> Here is an example that doesn't work:
> 
> if (1) {
> 
> =begin comment
> 
> print "ok";
> 
> =end comment
> 
> }
> 
> It gives the following error:
> Missing right curly or square bracket at E:\zzz.pl line 11, at end of line
> 
> If the user uses the not recommended
> 
> =start
> ...
> ...
> =cut
> 
> then it simply works, at least until a newer version of perl will decide 
> that this should give an error.
> 
> Octavian
> 
> 

i have tested this on my system and it works

if (1) {

=begin comment

print "ok";

=end comment
=cut
  }

goksie


Thread Previous | Thread Next


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