Chap. 4: Subroutines 1. What restrictions, if any, does P6 have on the naming of subroutines? * More generally, how may identifiers be spelled in P6? 2. What sigils, if any, does P6 use for subroutines? * When are they mandated? * When can they be omitted? 3. In what ways can I define a subroutine? * Where in a P6 program can I define a subroutine? * Does the meaning or impact of a P6 subroutine differ based on where it is defined in a program? 4. In what ways can I call a subroutine? 5. How do subroutines return values? * Is there any explicit 'return' operator? 6. How do I pass arguments to a P6 subroutine? * Does P6 have any special variable to hold the arguments passed to a subroutine? * Can I write subroutines with variable numbers of arguments? * What do P6 subroutines do in the case of excess parameters? * What do P6 subroutines do in the case of missing parameters? * What do P6 subroutines do when passed an empty list of arguments? 7. Can I define variables which are private to a subroutine? 8. Can I define variables which, more generally, are private to a block? 9. Does P6 have pragmas to enforce coding strictures? 10. Are there any rules in P6 governing when parentheses can be omitted from an expression? 11. Can you write subroutines which have the same name as a P6 built-in function? * How would you call such a subroutine? 12. Can P6 subroutines detect the context in which they are being called? If so, how? 13. How does a 'return' with no arguments behave in different contexts? * E.g., list? scalar? void? Exercises: Learning Perl, 4th ed., p. 67 # vim: textwidth=100: