Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Stray Variables

by jeyroz (Monk)
on Nov 05, 2004 at 19:01 UTC ( #405588=perlquestion: print w/replies, xml ) Need Help??

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

Replies are listed 'Best First'.
•Re: Stray Variables
by merlyn (Sage) on Nov 05, 2004 at 19:38 UTC
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.

    After Compline,
    Zaxo

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://405588]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2022-08-19 08:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?