in reply to Re^2: Passing Variables
in thread Passing Variables
"initialize my $sum = 0;"
An interesting variation, that is probably premature optimization in simple cases, is to:
sub average { my $sum = shift @_; ...;
For algorithms such as moving averages or integrators initializing the accumulator with the first sample value can be essential to avoiding large glitches at the start of the result data.
|
---|