I'm something of an old-timer, having learned (s)printf as a C coder
(pre-ANSI). The idiom that I internalized when I wanted to get leading zeros
instead of leading spaces was:
printf( "%2.2d", someInt );
And this still works, in perl the same as it does in C (except for having to
put a $ on the variable name). It's one of those cryptic uses of an otherwise
nonsensical construct: the "precision" setting (".2" representing two digits
of precision) would seem to be meaningful only for floats (number of explicit
digits right of the decimal point), but is made meaningful for ints as well
(number of explicit digits "left of the decimal point", as it were).
Just like everything else, there has to be more than one way to do it...
Dave Graff