I have a piece of code that looks a bit like this (slightly simplified for pasting purposes):

print STDERR "1:$orderid:$remainingamount > $requestedamount\n"; if ($remainingamount > $requestedamount) { bbcart::report_error(message => "$orderid:Amount approved by serve +r is more than the requested amount. So exiting."); die "Amount approved by server is more than the requested amount." +; }

Sometimes this code seems to trigger and report the error when the amounts are the same. I have received error reports like this:

12345:Amount approved by server is more than the requested amount. So exiting.

When I go to the error, log, it says this:

1:12345:2008 > 2008

But this doesn't always happen, just some of the time.

I am completely at a loss as to how to debug this. Can you think of any possible avenues of investigation? There is nowhere else in the code that outputs this error message. The variables are being printed with identical values immediately before the > comparison claims they are different.

What might possibly cause this?

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi

The code is running under mod_perl in 1.x Apache.


In reply to Numeric Comparisons Randomly Giving the Wrong Result by Likeless

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.