in reply to Re^3: Stupid mistakes I repeatedly make
in thread Stupid mistakes I repeatedly make
I deliberately use shift now, more and more, for two reasons:
- I have a personal coding convention that all methods should begin with "my $self = shift" (or "my $class = shift" for class methods).
- It opens up a place for me to comment on the expected type:
With the "my ($x, $y, $z) = @_" style, I don't have a clean place for those comments, unless I want to break the list on the left across many lines (ick).sub map_names { my $mapping = shift; # hashref of first-last names my $insensitive = shift; # boolean: should uppercase be the same? my @names = @_; # remaining parameters are names ... }
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Stupid mistakes I repeatedly make
by Anonymous Monk on Mar 28, 2005 at 19:51 UTC | |
by Anonymous Monk on Mar 29, 2005 at 12:03 UTC | |
by Anonymous Monk on Mar 30, 2005 at 01:42 UTC | |
Re^5: Stupid mistakes I repeatedly make
by Mutant (Priest) on Mar 29, 2005 at 11:19 UTC |
In Section
Meditations