-- Vladi Belperchinov-Shabanski <[EMAIL PROTECTED]>

On Wed, 20 Nov 2002 13:34:40 -0000
"Pense, Joachim" <[EMAIL PROTECTED]> wrote:

Bart Lateur [mailto:[EMAIL PROTECTED]] wrote:
(Mittwoch, 20. November 2002 11:43)

> On Wed, 20 Nov 2002 04:10:02 -0600, Steven Lembark wrote:
>
>> sub commify
>> {
>>	my ( $max, $sep, $end ) = ( shift, shift, shift );
>	...
>> }
>
> Wow! Hold it! Am I the only one who finds this absurd? More than one
> shift on the same array in one single expressing, sounds like bad style
> to me. Comments?

In one of my programs, this would be

sub commify {
    my $max = shift;
    my $sep = shift;
    my $end = shift;

    ...
}
I use this form too. it is more explicit and gives nice way to comment:

sub commify {
     my $max = shift; # this is arg 1 blah
     my $sep = shift; # arg two blah
     my $end = shift; # arg III, actually takes hash reference to useless
data :)
     ...
}

which is better than

  my ( $max,  # ala
       $sep,  # bala
       $end ) # nica
  = @_;

imo.

it is matter of taste of cource...

my ( ... ) = @_;

has the only advantage to be ~20% faster for large number of function
call iterations.

finally:

sub nonsensessez
{
  my $s = $_[0];
  my $a = $_[1];
  my $k = $_[2];
  my $j = $_[3];
  my $l = $_[4];

  1;
}

combines the best from both forms above ( i.e. cna be commented, clean and
approx. as fast as `my ( ... ) = @_' thing.
Only to the extent that you are not processing the remainder
of @_ after taking the fixed parameters -- that or you have
to remember to use the proper offset in a foreach or array
slice to access the argument array in for/map/grep.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                           +1 800 762 1582

Reply via email to