jeyroz has asked for the wisdom of the Perl Monks concerning the following question:
OK, newbie question. I have been modifying and re-modifying perl scripts and am finding old stray variables left behind here and there. The variables are being declared but not initialized in most cases. Is there a way the perl engine can detect an un-used variable? If I am using -w, will such warnings show up in an error log? Thanks for the help.
- j
•Re: Stray Variables
by merlyn (Sage) on Nov 05, 2004 at 19:38 UTC
|
| [reply] |
Re: Stray Variables
by Zaxo (Archbishop) on Nov 05, 2004 at 19:13 UTC
|
There is a "used once" warning which does what you want. Just make sure you have warnings enabled and run. They will be logged if STDERR is, for instance in CGI.
| [reply] |
Re: Stray Variables
by csuhockey3 (Curate) on Nov 05, 2004 at 19:18 UTC
|
always use strict and -w. Is there a reason you are not?
Perhaps I am misunderstanding what you might need (say you are using -w), have a look at Tie::Scalar::Timeout (also hash and array), more of an OO approach. | [reply] |
|