Ok Monks,
I think I'm almost there, but I'm still having problems with the comparing dates...I've decided to go with the Date::Calc module specifically the Delta_Days function. I think I have all the code down but it's not comparing the Delta_Days is not working with my if statement. Can anyone tell me what I'm doing wrong? My guess is my loops are all *@!$ed up but I don't know where to start.
Here's my code:
#!/usr/local/bin/perl5 -wT
print "Content-type: text/html\n\n";
use Date::Calc qw(Delta_Days);
@Months = ('1','2','3','4','5','6','7','8','9','10','11','12');
($Month_Day,$Month,$Year) = (localtime)[3,4,5];
$Year += 1900;
open(HANDLE,"../script_integration_data/script_integration_records");
while (<HANDLE>) {
@temp1 = split(/:/);
$domain = unpack ("A4", $temp1[40]);
$day_diff = Delta_Days($temp1[28], $temp1[30], $temp1[29], $Year, $
+Month, $Month_Day);
if (($domain eq "BBA") && ($temp1[36] eq "In Production") && ($day_
+diff <= 90)) {
$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;
}
# EOF
Much Thanks!
-Gus
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.