Hi,

I have two suggestions for you - one of which you may already know. First is that if you have not put use strict in your code, you really should. Most of these you can track down with the extra messages that use strict; presents.

If you have a legitimate condition where a value is used only once then there is another trick you can use to get rid of these: create a subroutine that is never called and use the variables in there:

# You never, ever want to call this. sub perl_unused_by_me { # You have to make sure your scope is correct here. $main::variable = 0; # You might also consider something like # undef $main::variable; # so that if this gets called by accident then your # code will produce an error at that point, not # silently use the bad data. }
Important: I really believe that if you need to do this, then there is something wrong with the way you have approached your program design. I found that as my skill increases situations where I have to do this have disappeared. In my mind that means I was initially doing things the wrong way. Usually that means using globals where passing by reference, even some slick OO or something (anything) more attractive would get the job done.

Good luck,
{NULE}
--
http://www.nule.org


In reply to Re: -w Error by {NULE}
in thread -w Error by Anonymous Monk

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.