fearcadi wrote:
* do we have have an axcess to the signature of the
subroutine if we have been passed only its reference .
that is , for exemple , can
process( @x , &step )
guess how many arguments &step expects ?
I'd expect that Code objects would have a C<signature> or C<sig> method:
&subname.sig()
$subref.sig()
* how one can call subroutine "in place"
sub (str $x , int $n ) {
$x ~ ["one, "two", ... , "hundreed"][$n]
} . ( "/home/temp/", $f ) ;
Yes. Or, if you're not gung-ho on explicit typing:
{ $^x ~ ["one, "two", ... , "hundreed"][$^n] }.("/home/temp/",$f)
or
given ( "/home/temp/", $f )
-> ( str $x , int $n ) {
$x ~ ["one, "two", ... , "hundreed"][$n]
};
it seems that the last does not work because given take only one argument.
That's right. But this does:
for "/home/temp/", $f
-> str $x , int $n {
$x ~ ["one, "two", ... , "hundreed"][$n]
}
Damian