Thank you so much to everyone that contributed ideas to my question. Your input has been very valuable! Here's my solution (it's not the tightest code, but it gets the job done)

#!/usr/local/bin/perl5 -wT print "Content-type: text/html\n\n"; $debug = 0; # Set 1 to enable debug; set to 0 to disable. use Date::Calc qw( Date_to_Days ); @Months = ('1','2','3','4','5','6','7','8','9','10','11','12'); ($Month_Day,$Month,$Year) = (localtime)[3,4,5]; $Year += 1900; $date = Date_to_Days($Year,$Month,$Month_Day); Debug (" Current date is: $date <br>"); open(HANDLE,"../script_integration_data/script_integration_records"); while (<HANDLE>) { @temp1 = split(/:/); $domain = unpack ("A4", $temp1[40]); if (($domain eq "BBA") && ($temp1[36] eq "In Production") && ($temp +1[38] != "-") && ($temp1[38] != "--")) { $script_date = Date_to_Days($temp1[31],$temp1[30],$temp1[29]); Debug ("$temp1[31],$temp1[30],$temp1[29]"); $diff_date = abs ($date - $script_date); Debug ("script date is: $script_date and difference is: $diff_d +ate days. and $temp1[0]<br>"); # If diff_date is greater than 90 days we exectue. if (($diff_date <= 90) && ($diff_date > -$diff_date)) { $sum += $temp1[38]; $count++; } } } close(HANDLE); $average = $sum / $count; if ($average >= 44) { print sprintf "<blink><font color=\"#FF0000\">%.f days</font></blin +k>", $average; } elsif (($average >= 11) && ($average <= 44)) { print sprintf "<font color=\"#FFFF00\">%.f days</font>", $averag +e; } elsif ($average <= 10) { print sprintf "<font color=\"#669900\">%.f days</font>", $average; } sub Debug { if ( $debug ) { my $msg = shift; print $msg, "\n"; } } # EOF


-Gus I just changed up a bit by taking the absolute value instead of just getting the difference...I almost missed that, but luckily I caught it in time. Time to brush up on that 'ole math. :-)

In reply to Re: Am I missing something here? I GOT IT EVERYONE! by suggus
in thread Am I missing something here? by suggus

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.