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

Re: Multiline comment in Perl

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
May 22, 2008 03:45
Subject:
Re: Multiline comment in Perl
"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."


Thread Previous | Thread Next


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