|
|
| Syntactic Confectionary Delight | |
| PerlMonks |
Re: Re: Subroutine Bewildermentby dimar (Curate) |
|
| on May 29, 2004 at 18:16 UTC ( #357492=note: print w/ replies, xml ) | Need Help?? |
|
in reply to Re: Subroutine Bewilderment
AFAIK there is now no type of subroutine that MUST be called with a leading ampersand or without comma's seperating the argumentshmmm ... I could have emphasized more the 'definition' I was considering for MUST and MUST NOT. In other words, think of it like a kind of puzzle, can I write code in such a way that violating the rule will cause an error or a warning?. Then, if you find an answer to the puzzle, consider whether the code is likely to happen in the 'real world' ... if 'yes', then you have a candidate for MUST and MUST NOT. I have found this approach to be useful because it essentially asks "how many different ways can I (legally) say the same thing?" For example, here is code that illustrates the ampersand 'rules'.
As far as a subroutine call where separating commas MUST NOT be included, consider a user-defined subroutine that works like map CODEBLOCK ARRAY putting a comma between CODEBLOCK and ARRAY causes error. Note that we don't run into problems until we start introducing prototypes, which generally people say to "stay away from", which is fine, but with caveats...
|
|
||||||