Thanks a lot Jose and Ramprasad.
----------------------------------------------------------------------------
----------------

regards,

Ajitpal Singh,
Wipro Technologies.
Finchley,London.
Tel:044 208 495 6317
Mobile:07900534143



-----Original Message-----
From: Jose Alves de Castro [mailto:[EMAIL PROTECTED]
Sent: 20 May 2004 12:21
To: Singh, Ajit p
Cc: [EMAIL PROTECTED]
Subject: Re: regular expr.


On Thu, 2004-05-20 at 12:16, Singh, Ajit p wrote:
> Hello everybody,
> 
> My problem is that I have a define a variable which combines two other
> variables with preceeding zeroes.
> 
> i.e final_variable :  <3 digit var1><5 digit var2>
> 
> if var1 is single digit i have to preceed it with two zeroes. eg : 002
> if var1 is double digit i have to preceed it with one zero. eg : 022
> 
> Similarly,
> for var2 is single digit i need to preceed with four zeroes .eg :00005
> for var2 is double digit i need to preceed with three zeroes .eg :00054
> for var2 is a three digit number i need to preceed with two zeroes .eg
> :00542
> and so on..

This should do the trick:

$var = sprintf("%03i%05i",$var1,$var2);


> can someone pls help me out on the above...
> 
>
----------------------------------------------------------------------------
> ----------------
> 
> regards,
> 
> Ajitpal Singh,

HTH,

jac

-- 
Josà Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de InformaÃÃo

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


Reply via email to