On Sat, May 05, 2012 at 09:15:29AM +0100, Denis Howe wrote: > On Fri 2012-05-04 07:13:17, denis.howe@gmail.com wrote: > > these are *subroutines*. > > So why does the doc say that it is not good style to prefix them with > "sub"? Because they don't behave like subroutines in any way - you > can't call them, they don't take arguments or return anything. (In > fact the option to prefix them with sub sounds like a confusing, > historic wart that should be retired.) Not quite true. The default array for shift is on @_, not @ARGV, inside them. Yes, @_ is empty. But if you use shift; expecting it to be on @ARGV, you will be confused. This is a trap I've fallen into. > > There is an argument to be made that they belong in perlsub > > Only if you can convince us they are subroutines. You're not phrasing that correctly. They *are* subroutines. That's what they are internally. What matters is whether from a language user perspective whether they are so far from subroutines that they have more in common with some other part of the language than with subroutines. Nicholas ClarkThread Previous | Thread Next