Where exactly does $month go from having a value to not having a value? You should add lines like the following until you pinpoint the exact line of code at which it's going bad:

print "1: input-month: \"$input{'month'}\"<BR>\n"; ... print "1: month: \"$month\"<BR>\n"; ... print "2: month: \"$month\"<BR>\n"; ...
Add them starting with the first time you reference $month, and then keep adding them until you get to one that doesn't have the value. Or, start in the middle somewhere and do a binary search.

-Make sure to number them or make them unique in some other way so that you can see correlate the output to the code.
-Although maybe not necessary here, quoting the value is useful in general when printing debugging html because you can clearly see extra spaces (newlines, etc.) in the value that get collapsed into a single space or ignored by the browser.

Just adding these print statements and identifying where the value is lost should make it clear to you what's going wrong. If it doesn't, then post the new code and note exactly where the value disappears and it might be clear to someone else here. It seems like such an ugly and stupid way of debugging but simple print statements are often the quickest way to find bugs of this sort.


In reply to Re: Re: Re: problem with variable by blahblahblah
in thread problem with variable by cal

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.