#!/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
In reply to Re: Am I missing something here? I GOT IT EVERYONE!
by suggus
in thread Am I missing something here?
by suggus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |