Hello!

I'd like to wonder if there's a provision in Perl to give out warning messages about unused variables. C has this. Lint has this for C in more detail. But, it seems Perl doesn't. It could go a ways for helping clean up code.

--- Sample Code Start ---
#!/usr/local/bin/perl -W
use strict;
my $var_a;
print("Hello, world\n");
--- Sample Code End ---

No warning messages are created for this, despite $var_a being unused and irrelevant.

If there is a provision in Perl to do this, please email me. I would be happy to write a module to do this, but I think it probably would be quite difficult and involve lots of Perl internals that probably would change with Perl 6 anyway. Damian & Larry, are you listening? (grin).

Thanks to anyone who responds here or has a hint... Cordially, Kevin

-----------------------------------------------------
Kevin J. Rice
CPAN PAUSE ID: KEVINRICE / Chicagoland, IL, USA
Homepage(with email on it): JustAnyone.com
-----------------------------------------------------


In reply to Need Unused Variable Warning Msgs by justanyone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.