I'm running this as a cron job 1 minute after midnight on Saturday nights (Sunday morning) so as to cover all of Saturday back through the previous Sunday. Does your suggestion mean I'd have to run it late Sunday night in order for it to cover Saturday back to the previous Sunday (since the timestamp would be 24 hours ago)? Or is what you laid out basically the same as what I did only more precise and the accurate way to do it (which is a somewhat ridiculous question as I don't think you'd give me inaccurate ways to do something ;) )?
I'm also guessing that this corrects the problem I mentioned regarding skipping the 31st of Jan which was in the middle of the week. Is that a good assumption? Mathew Tom Phoenix wrote: > On 2/3/07, Mathew Snyder <[EMAIL PROTECTED]> wrote: > >> my @date = (localtime)[3..5]; >> my $day = sprintf '%02d', $date[0] - 1; >> my $month = sprintf '%02d', $date[1] + 1; > > You shouldn't have to do arithmetic on the date components, including > all that mess about how many days are in a month. That's hard to get > right; besides, somebody else has debugged all that already. Do the > arithmetic on the time, instead, and you'll have the right date: > > my @date = (localtime (time - 24*60*60) )[3..5]; # 24 hours ago > was yesterday > > Good luck with it! > > --Tom Phoenix > Stonehenge Perl Training > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/