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.
In reply to Re: Using a Variable Mutipule times(with different data)
by fundflow
in thread Using a Variable Mutipule times(with different data)
by Keef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |