perl6/doc/lib/Sub

doc src
(title) class Sub
    class Sub is Routine { }

 
A type for subroutines. Subs are created with the sub keyword
    my $s = sub ($a, $b) { $a + $b };
    say $s.WHAT;        # Sub()
    say $s(2, 5);       # 7

 

Perl 6 Tricks and Treats newsletter

Register to the free newsletter now, and get updates and news.
Email:
Name: