Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Passing Variables

by GrandFather (Saint)
on Mar 01, 2021 at 00:40 UTC ( #11128926=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11128926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2021-04-23 07:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?