Like Luke's solution, but using Date::Simple which comes with the standard distro of Perl.
#!/usr/bin/perl use strict; use warnings; use Date::Calc qw/ Day_of_Week Add_Delta_Days /; my @days = (undef, qw/ Mon Tue Wed Thur Fri Sat Sun /); if ($ARGV[0] !~ /^\d{4}-\d{2}-\d{2}$/) { die "Date given must be in YYYY-MM-DD form.\n"; } my @ymd = split /-/, $ARGV[0]; # year,month,day my $dow = Day_of_Week @ymd; my $mon = sprintf "%s-%02s-%02s", Add_Delta_Days @ymd, 1 -($dow==1 ? 8:$dow); my $sun = sprintf "%s-%02s-%02s", Add_Delta_Days @ymd, 7 -($dow==7 ? 0:$dow); print "Previous Monday: $mon\n"; print "Given Date: $ARGV[0] $days[$dow]\n"; print "Next Sunday: $sun\n"; Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>