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.
In reply to Warning about unused lexical variables by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |