[Perl5-syntax] signature syntax for method return values

Michael G Schwern schwern at pobox.com
Wed Mar 4 11:18:11 GMT 2009


Paul LeoNerd Evans wrote:
> On Tue, 03 Mar 2009 13:02:22 -0800
> Michael G Schwern <schwern at pobox.com> wrote:
> 
>>     method foo (Str $arg) returns ArrayRef {
>>         my @list = something($arg);
>>         return @list;
>>     }
> 
> How about
> 
>   method foo (Int $n) returns ArrayRef from_list {
>      my @list = ( { foo => 'bar' } ) x $n;
>      return @list;
>   }

Pyrrhus would be proud!


-- 
You know what the chain of command is? It's the chain I go get and beat you
with 'til you understand who's in ruttin' command here.
        -- Jayne Cobb, "Firefly"



More information about the Perl5-syntax mailing list