http://qs321.pair.com?node_id=11128926


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.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond