That isn't an error per say.. It's a warning. What it's complaining about the > test because at the time $counter has not yet been initialized. Note that being declared and being initialized are two different things. Perl will automatically assume, if it hasn't yet been initialized, that its value is 0 or an empty string depending on where you're using it for the first time.

In short, if the automatically-set-to-zero behavior is acceptable, you don't need to give the warning any thought. But if at the time that warning is produced, you're expecting $counter to have a value, you should look at your code and see where you aren't assigning something to it where you should.

Once bread becomes toast, it can never be bread again.

In reply to Re: uninitalised value in numeric by Android 18
in thread uninitalised value in numeric 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.