Re: Multiline comment in Perl

[email protected] ("Dr.Ruud")
Newsgroups perl.beginners
Organization Chaos rules.
Message-ID <[email protected]>
"Dr.Ruud" schreef:
> Paul Johnson:

>>     sub half
>>     {
>>         my ($val) = @_;
>>         $val / 2;
>>         q/
>>         Returns $val divided by 2
>>         /;
>>     }
>
> Variant:
>
>      sub half {
>          return unless defined $_[0];
>          return $_[0] / 2;
>
>          q/*
>            Returns
>            $val
>            divided
>            by 2
>          */
>      }
>
> q/*
>   This is
>   a multi-
>   line comment.
> */ if 0;

I forgot to add that this compiles clean under strictures and warnings.

-- 
Affijn, Ruud

"Gewoon is een tijger."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.