> -----Original Message-----
> From: SilverFox [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 10, 2003 1:14 PM
> To: [EMAIL PROTECTED]
> Subject: Playing with Numbers
> 
> 
> Hi all, i'm trying to figure out how to test if a number is 
> five digits and 
> if not add zero/s in front to make it 5 digits. Any ideas?????
> 
> Examples:
> 
> 444  = 00444
> 4120 = 04120
> 23   = 00023
> 

What if the number is greater than 5 digits?  For the input you provide,
this works:

my $five_digit_number = sprintf "%05d", $original_number;

If the number is 5 or more digits, then just the original number is
returned.

-Mark

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to