> >
> > Where possible, use @_ rather than shift.  shift is slower.
> >
> >     my $var = shift;                     # wrong
> >     my ($var) = @_;                      # right

I didn't have benchmarked it, but from the internal implementation, I would
expect that the first is faster then the second, because the second is a
array copy, while the first is only a scalar copy (and shift is very fast
anyway, because it only increments the base index)


> Personaly this whole section stinks. People use different methods, but for
> me, I try and avoid direct @_ access unless absolutely necessary. For
> method calls I prefer:
>
>   my $self = shift;
>   my ($param1, $param2) = @_;
>

Why not

my ($self, $param1, $param2) = @_;

?

> >
> >    sub CONSTANT { 50; }
>
> That's not compiled as a constant - you forgot the empty prototype.
>

and "use constant" is much better readable, also it's also turned into a
(inlined) sub by Perl, especialy for non Perl gurus.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


Reply via email to