I just wrote another message in which I mention rarely using the components from list-context localtime(), except to feed into strftime(). This is one of those rare situations which call for using the components. In scalar context, localtime() gives you a fully formatted date-time string, but in list context it returns:
my ( $seconds, $minutes, $hours,
$day_of_month, $month_idx, $years_since_1900,
$day_of_week_number, $day_of_year, $id_dst
) = localtime($now);
So rather than generating a date string "Sat Aug 21 22:00:53 2010" and then parsing it with a regex ( not even substr()! .. shocking! ), why not use the day of the week component .... 0 == Sunday through to 6 == Saturday.
$now -= 43200 while (localtime($now))[6]; # count back half days till
+Sunday
--
TTTATCGGTCGTTATATAGATGTTTGCA
|