On Tue, 2008-09-16 at 17:32 -0700, [EMAIL PROTECTED] wrote: > Hello > > I am sure the answer to this question is very simple. I have a number value > which I am inserting into a string I am building. How can I append the number > into the string so that it will always be 2 characters in length? In other > words if the month is 9, how can I make it appear as "09"? > > Thanks, > Andrew >
$string = sprintf( '%02d', $number ); See `perldoc -f sprintf` for details. -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." Cross Time Cafe "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/