#!/usr/bin/perl -w
use strict;
my $date = \'2002-09-06\';
sub dayofweek {
my @years = (0, 2, 3, 4);
my @month = (undef, 0, 3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5);
my @days = (\'Sun\', \'Mon\', \'Tue\', \'Wed\', \'Thu\', \'Fri\', \'Sat\');
my $date = shift;
my ($yy, $mm, $dd) = split(/\\-/, $date);
$dd =~ s/^0//;
$mm =~ s/^0//;
my($tmp, $a, $b, $c, $e);
$tmp = $yy - 1996;
$a = $tmp & 3;
$b = ($tmp >> 2) + ($tmp & hex("FC"));
$c = $month[$mm];
if($a == 0 && $mm > 2){$c++;}
$a = $years[$a];
$e = ($a+$b+$c+$dd) % 7;
return $days[$e];
}
print "The day($date) is: ".dayofweek($date)."\\n"