in reply to Using a Variable Mutipule times(with different data)
The use of different variables for different things is preferred
as when someone reads/debugs your code it is clear that the
different instances relate to different data.
All compilers nowadays (including perl, according to the excellent
explenation here) define the scope of the variable, so
the "dangling" variables get cleared away as soon as they
are done.
An exception for this is objects that require expensive setup (like ftp connection for example). In these cases it makes more sense, from optimization point of view, to reuse these resources.
Sorry for not giving actual timing data, maybe someone will benchmark it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Using a Variable Mutipule times(with different data)
by b (Beadle) on Dec 30, 2000 at 02:50 UTC |