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 right? Also, the year still >> needs >> to be fixed by adding 1900 but from what I've read that is due to the way >> computers work and not necessarily because of Perl. >> > > I think it's better to write: > > my ($day,$month,$year) = (localtime (time - (24*60*60)))[3..5]; > > and you still need to add these two statements: > > $month++; > $year+=1900; > > > > > > -- > Jeff Pang > EMAIL: [EMAIL PROTECTED] AIM: jeffpang >
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. Mathew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/