blazar has asked for the wisdom of the Perl Monks concerning the following question:
An interesting question (link @ GG) just asked in clpmisc by Peter J. Holzer:
Occasionally I notice a lexical variable sticking around which isn't used any more and can/should be deleted, like in this (stupid) example:
#!/usr/bin/perl use warnings; use strict; my $x; my $y; $y = 42; print "$y\n"; __END__This can be made slightly more complex by changing my $x to
my $x = compute_some_value();where $x is assigned a value which is subsequently never used.
It would be nice if perl could warn about lexical variables which are never used in their scope after their initialization. Does anybody else find this useful, and if so, is there a reason (besides "life is short") why it hasn't been implemented?
Update: pasted herafter a reply given in clpmisc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Warning about unused lexical variables
by Rhandom (Curate) on Sep 04, 2007 at 20:20 UTC | |
|
Re: Warning about unused lexical variables
by kyle (Abbot) on Sep 04, 2007 at 19:19 UTC | |
by xdg (Monsignor) on Sep 04, 2007 at 20:52 UTC | |
by bart (Canon) on Sep 05, 2007 at 11:06 UTC | |
by papidave (Pilgrim) on Sep 07, 2007 at 22:08 UTC | |
|
Re: Warning about unused lexical variables
by toolic (Bishop) on Sep 04, 2007 at 18:11 UTC | |
|
Re: Warning about unused lexical variables
by sgt (Deacon) on Sep 04, 2007 at 18:27 UTC | |
|
Re: Warning about unused lexical variables
by blazar (Canon) on Sep 05, 2007 at 09:56 UTC | |
by blazar (Canon) on Sep 07, 2007 at 10:30 UTC | |
|
Re: Warning about unused lexical variables
by bduggan (Pilgrim) on Sep 06, 2007 at 17:06 UTC |