2008/9/17  <[EMAIL PROTECTED]>:
> 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"?
>

I was stuggling with this. Thanx Shawn I had %2d and was reading
through sprintf.

#!/usr/bin/perl

use strict;
use warnings;

my @nums = (1..12);
for (@nums) {
        printf("%02d\n", $_, 0);
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to