>Von: Moran, Matthew [mailto:[EMAIL PROTECTED]] >Gesendet am: Mittwoch, 20. November 2002 14:41 >Joachim suggested: >> sub commify { >> my $max = shift; >> my $sep = shift; >> my $end = shift; >> >> ... >> } >> >> better or even worse in your view? > >Clearer, but just as bad IMHO. I've always done it as
>sub subroutine( > my ($list, &of, $variables) = @_; ># rest of code here >} >It's how it's always shown in the Cookbook & what have you. Not *always*, I've seen my version explicitly suggested somewhere. The advantage in my eyes is that you consume the input parameters so they are gone when you read them. It is also easier to check in the end if there are any left so too many were supplied. My formatting makes the parameters easy to comment. The overhead of the shift should not be relevant. But anyway, the parameter mechanism I'd prefer before positional parameters would be sub mysub { my %params = ( thiskey => 'default1', anotherkey => 'default2', @_ ); # do something } without any shifting and consuming and whatever. fwiw, Joachim