On 02/19/2014 03:02 PM, Michael R. Davis wrote:
I actually don't like the current popular practice of doing
my ($self, $a, $b, $c)=@_;
i teach that as it is slightly faster (no shifting of @_) and you can
see all the args in one place. sometimes i have seen bad code with some
shifts deep in the sub and those are hard to follow.
I much prefer
my $self = shift;
my $a = shift;
my $b = shift;
as I can
my $self = shift;
my $a = shift || "default";
my $b = shift // 0;
and actually understand what I did months later.
so just do them later as regular statements without the my. that way you
get the args in one step, you do defaulting in another.
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/