On Tue, Apr 24, 2001 at 11:00:40AM -0500, Arante, Susan wrote:
: Could someone tell me why this is happening?  When I use this command, it
: used to give me 20010405.doc (yyyymmdd.doc), now it's giving me 2001 4 5.doc
: - I'm losing the leading zeros.  
: Command is on Perl 5 - printf("\%s%02s%02s.doc",$year,$month,$day).


Try this:

printf( "%04d%02d%02d", $year, $month, $day );

for printf(), %d is used for integers and integers will be right
padded with zeros, like you want.

See:

perldoc -f printf

Enjoy!

-- 
Casey West

Reply via email to