my $yr = (localtime)[5]; # don't need to get all values

prinf("%02d",$yr%100); #or you can put the value in a variable using
sprintf.

voilą

Etienne

Glenn Cannon wrote:
> 
> I am trying to force the current year to be show as a two digit
> number, with
> leading zero if necessary.
> Here is what I am using currently, what am I doing wrong?
> 
> #Code On
> 
> @now = localtime;
> if (length($now[5] % 100) == l)
> {
> $year = sprintf("%02d", $now[5] % 100)
> }
> else
> {
> $year = $now[5] % 100
> }
> 
> #Code Off
> 
> Glenn Cannon
> [EMAIL PROTECTED]
> Level II Certified DCI Judge
> 'There is no spoon.'
> www.eventsbeyondbelief.com
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to