----- Original Message -----
Hello everyone,
I'm having trouble with sprintf. I know it's some silly mistake I'm
making, but can't seem to figure it out.
Here's what I have:
my @time = localtime();
$time[4]++;
$time[5] += 1900;
my $lastmonday = sprintf("%02d", $time[5]) . sprintf("%02d", $time[4]) .
'01';
My result is: 20050901, but what I'm trying to get is 050901.
Any ideas what I'm doing wrong?
Try:
$time[5] -= 100;
instead of:
$time[5] += 1900;
Or use substr($time[5], 2, 2) after the previous line.
Teddy
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>