Re: number 1 showing up in printf output I don't understand

2002-07-07 Thread Connie Chan
2:19 PM Subject: number 1 showing up in printf output I don't understand > Odd extra '1' showing up? Can someone explain this. > > #!/usr/local/bin/perl -w > my $current_date = getdate(); > print "$current_date\n"; > exit(); > sub getdate { > m

Re: number 1 showing up in printf output I don't understand

2002-07-07 Thread Robert Kasunic
Hello Zachary, On Sat, Jul 06, 2002 at 11:19:58PM -0700, Zachary Buckholz wrote: > Odd extra '1' showing up? Can someone explain this. > my $current_date = printf("%04d-%02d-%02d", $year+1900, $month+1, $day); ^^ The problem lies here. You have to use sprintf to get a

number 1 showing up in printf output I don't understand

2002-07-07 Thread Zachary Buckholz
Odd extra '1' showing up? Can someone explain this. #!/usr/local/bin/perl -w my $current_date = getdate(); print "$current_date\n"; exit(); sub getdate { my ($day, $month, $year) = (localtime)[3,4,5]; my $current_date = printf("%04d-%02d-%02d", $year+1900, $month+1, $day); return($current_d