Why am I getting the following output when I use warnings?
<SNIP>
Use of uninitialized value in concatenation (.) or string at ./mship.pl line 33.
Well, I'm in a hurry and I've not checked carefully the rest of this post and the answer you got. However it seems to me that you've been helped to track down that warning to something wrong you were doing. So indeed the warning has served its purpose.

Said this, it may be worth mentioning that this particular warning is proably the one that most often can be locally disabled out of good reasons, i.e. you may have a situation in which you need to e.g. interpolate a variable which can possibly be undefined and you may want to let it be interpolated silently as the empty string. If you need cope with such a state of things, of course TIMTOWTDI, but a sensible one can be to include the warning generating line(s) in a block like this:

{ no warnings 'uninitialized'; # Do what you wanna... }

Please note that I'm not suggesting this as a means to get rid of the warning the next time you'll encounter it. You should really use it only if you know in advance that you may receive that warning, but you don't want to be warned...


In reply to Re: how is this uninitialized? by blazar
in thread how is this uninitialized? by tcf03

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.