Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Perl Programming guidlines/rulesby Aristotle (Chancellor) |
on Nov 27, 2002 at 16:05 UTC ( [id://216093]=note: print w/replies, xml ) | Need Help?? |
There's two cases I shift:
and something like
The first case is somewhat arbitrary and maybe a bit superstitious; I just like to consistently always shift off the $self when I'm writing OO code - something about that one parameter's significance makes it feel right to me. The second case is plain and solid reasoning: I hate to name variables when I don't need to. Temporaries should always hold computed, not copied values, in my opinion. (You also have to work on @_ in case you wanted to modify the passed values - which of course is to be used seldomly and carefully and orthogonal to shifting.) The second case is an exception of course though not exactly a red herring either. So in general, I would agree; my (@variables) = @_; is preferred. There are good reasons not to, occasionally, however. Makeshifts last the longest.
In Section
Meditations
|
|