%U week of year, Sunday as first day of week - 01 to 53 %W week of year, Monday as first day of week - 01 to 53 #### get today's date. get today's week of year. (WOY) while the current day's WOY = today's WOY retrieve and print articles #### use POSIX; use strict; # # get epoch time and format to Week of Year. # my $today = time; my $current = strftime("%W",localtime($today)); # # Is today a sunday? # if (strftime("%w",localtime ($today))==0) { # # Yes, retrieve last week's news. # print "getting last week's news.\n"; } else { # # Nope, look for each day this week. # my $check = $current; while ($check==$current) { # # while WOYs are equal, retrieve that day's news. # print scalar(localtime($today)) , " is this week. Retrieving articles.\n"; # # back a day. # $today -=86400; $check = strftime("%W",localtime($today)); } }