Re: Please help with convoluted script

2007-02-12 Thread Ken Foskey
On Sun, 2007-02-04 at 07:27 -0800, 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

Re: Please help with convoluted script

2007-02-11 Thread Dr.Ruud
Mathew Snyder schreef: > I need to make sure $day and $month are in 2-digit format Don't mix value and presentation. Variant-1: perl -wle' my $i = 0; my ($day, $month, $year) = map $_ + (0, 1, 1900)[$i++], (localtime)[3..5]; printf qq/%04d %02d %02d\n/, $year, $month, $day; '

Re: Please help with convoluted script

2007-02-11 Thread Mathew Snyder
Rob Dixon wrote: > Mathew Snyder wrote: >> Tom Phoenix wrote: >>> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: >>> 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 su

Re: Please help with convoluted script

2007-02-11 Thread Owen
On Sun, 11 Feb 2007 03:51:17 -0500 Mathew Snyder <[EMAIL PROTECTED]> wrote: > Jeff Pang wrote: > >> #!/usr/bin/perl > >> > >> use warnings; > >> use strict; > >> > >> my @date = (localtime (time - (24*60*60)))[3..5]; > >> > >> foreach my $i (@date) { > >>print $i . "\n"; > >> } > >> >

Re: Please help with convoluted script

2007-02-11 Thread Rob Dixon
Mathew Snyder wrote: > Tom Phoenix wrote: >> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: >> >>> 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 t

Re: Please help with convoluted script

2007-02-11 Thread Jeff Pang
> >I need to make sure $day and $month are in 2-digit format so that wouldn't >work. > At least, not anyway I'm presently familiar with. I tried to use sprintf in >there but it failed because of not enough arguments. $day = '0' . $day if length($day) < 2; $month = '0' . $month if length($month

Re: Please help with convoluted script

2007-02-11 Thread Mathew Snyder
Owen wrote: > On Sun, 11 Feb 2007 03:18:00 -0500 > Mathew Snyder <[EMAIL PROTECTED]> wrote: > >> Tom Phoenix wrote: >>> On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: >>> I'm running this as a cron job 1 minute after midnight on Saturday nights (Sunday morning) so as to cover all of Saturd

Re: Please help with convoluted script

2007-02-11 Thread Owen
On Sun, 11 Feb 2007 03:18:00 -0500 Mathew Snyder <[EMAIL PROTECTED]> wrote: > Tom Phoenix wrote: > > On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: > > > >> 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 th

Re: Please help with convoluted script

2007-02-11 Thread Mathew Snyder
Jeff Pang wrote: >> #!/usr/bin/perl >> >> use warnings; >> use strict; >> >> my @date = (localtime (time - (24*60*60)))[3..5]; >> >> foreach my $i (@date) { >>print $i . "\n"; >> } >> >> exit; >> >> I get this: >> >> 10 >> 1 >> 107 >> >> >> I still have to add 1 to the month. Is that r

Re: Please help with convoluted script

2007-02-11 Thread Jeff Pang
> >#!/usr/bin/perl > >use warnings; >use strict; > >my @date = (localtime (time - (24*60*60)))[3..5]; > >foreach my $i (@date) { >print $i . "\n"; >} > >exit; > >I get this: > >10 >1 >107 > > >I still have to add 1 to the month. Is that right? Also, the year still needs >to be fixed

Re: Please help with convoluted script

2007-02-11 Thread Mathew Snyder
Tom Phoenix wrote: > On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: > >> 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 nigh

Re: Please help with convoluted script

2007-02-09 Thread Tom Phoenix
On 2/9/07, Mathew <[EMAIL PROTECTED]> wrote: 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 Saturd

Re: Please help with convoluted script

2007-02-09 Thread Mathew
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 timest

Re: Please help with convoluted script

2007-02-04 Thread Tom Phoenix
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

Please help with convoluted script

2007-02-03 Thread Mathew Snyder
I have a script which is supposed to query a database and compile data for every day of the week prior to when it runs. I thought I had set it so that if the first of a month falls in the middle of the week it would roll the month back to the previous one after all the data for the first is gather