Joe Gottman asked:
my RETTYPE sub NAME ( PARAMS ) TRAITS {...} # lexical only
our RETTYPE sub NAME ( PARAMS ) TRAITS {...} # also package-scoped
sub NAME ( PARAMS ) TRAITS {...} # same as "our"
Note that the third possibility here does not include a return type. Does
this imply that if we want to declare a subroutine with a return type we
have to declare it as either a "my" sub or an "our" sub?
No. One of the available TRAITS is C<returns RETTYPE>. So you can always
specify a "postfix" return type, even without a declarator:
sub data() returns Str {...}
The declarator is only needed if you want to "prefix" your return type
(presumably because you're pining for C/C++ ;-):
our Str sub data() {...}
Damian