Date time problem while executing perl script.

Hi All,

This Monday 15th March 2010, i have faced a weired issue with my Perl script execution, this script is scheduled to run at 1 minute past midnight on daily basis ( 00:01 EST ) generally for fetching previous business date , say if it is Monday it should give last Friday date, for Tuesday it should get me last Monday date, for Wednesday it should fetch last Tuesday date and so on ...

but when it ran this monday 15th march it behaved in weired manner which i have never seen it happen in last 3 - 4 month, even though this script was executed at 00:01 EST Mar 15, 2010 it gave me output date for last Thursday date ( which i have mentioned only for cases where datatime > 20 hrs )

Can someone explain me this behavior? is there anything to do with DST changes which US entered this Sunday???

Below is the Perl script for reference.

bash-2.05$ cat prev_biz_date_yyyymmdd.pl
#!/usr/local/bin/perl

use POSIX;

our $nextDay;
our $dayOfWeek;
our $datetime;

$dayOfWeek =`date +%w`;chomp($dayOfWeek);

# Get My Date
my $info = scalar localtime(time);
$info =~ s/ +/ /g;
($dtime) = (split(/\:/,$info))[0];
($datetime) = (split(/ /,$dtime))[3];

our $outFile = "/ilx/ftp/date/prev_biz_date_yymmdd.date";

# Create some semaphore
`cat /dev/null > $outFile`;

SWITCH: {
        if ($dayOfWeek == 0){
            $WorkDate = get_date(2);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 1){
            $WorkDate = get_date(3);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 2){
            $WorkDate = get_date(1);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 3){
            $WorkDate = get_date(1);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 4){
            $WorkDate = get_date(1);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 5){
            $WorkDate = get_date(1);
             print "$WorkDate\n";
             last SWITCH;   }
        if ($dayOfWeek == 6){
            $WorkDate = get_date(1);
             print "$WorkDate\n";
             last SWITCH;   }

}

open (OUT,"> $outFile ") || die "$!\n";
        print OUT "$WorkDate\n";
close OUT;

sub get_date {

        our $wkday = shift;chomp($wkday);

        if ($datetime <= 20) {
                $WorkD = strftime("%Y%m%d", localtime(time - ($wkday * 86400)));
        }else{
                $WorkD = strftime("%Y%m%d", localtime(time - (($wkday + 1) * 86400)));
        }
        return $WorkD;
};