[ic] {Spam?} Leading 0 - calc issue.

Rick Bragg lists at gmnet.net
Tue Sep 6 19:27:24 UTC 2011


I am trying to increment a number and keep it's leading 0.  (I need the
result to be 2 digits long)  

The following works fine and returns "08":

[tmp number]07[/tmp]
[calc]
my $num = [scratch number]+1;
$num = sprintf("%2d", $num);
$num =~ tr/ /0/;
return $num;
[/calc]

However, if I use 08, or 09, I get "0" returned.  Any idea why?

[tmp number]08[/tmp]
[calc]
my $num = [scratch number]+1;
$num = sprintf("%2d", $num);
$num =~ tr/ /0/;
return $num;
[/calc]

[tmp number]09[/tmp]
[calc]
my $num = [scratch number]+1;
$num = sprintf("%2d", $num);
$num =~ tr/ /0/;
return $num;
[/calc]

Thanks!
Rick










More information about the interchange-users mailing list