Coding in Perl: Finding unused variables
How can I locate unused variables and/or dead code in Perl? This can easily be done in Java with an IDE. Can it be done in Perl?
This is a single stand-alone script and I will spo开发者_如何学Ct any variables that might be used in one of the requires.
Perl::Critic is a comprehensive package for source-code standards checking. It's capable of finding unused variables and unreachable code among many other things.
See warnings::unused.
This pragmatic module extends lexical warnings to complain about unused variables.
It produces warnings when a
my
variable orstate
variable is unused aside from its declaration.
精彩评论