[Perl5-syntax] signature syntax for method return values

Paul LeoNerd Evans leonerd at leonerd.org.uk
Wed Mar 4 09:49:25 GMT 2009


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;
  }

-- 
Paul "LeoNerd" Evans

leonerd at leonerd.org.uk
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/perl5-syntax/attachments/20090304/25598389/signature.pgp


More information about the Perl5-syntax mailing list